Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

had a ton of trouble getting jupyterlab to target an arbitrary virtualenv


The trick is that you have to deactivate the virtual environment and then resource it after adding Jupyter to that virtual environment.

Most shells cache executable paths, so the path for jupyter will be the global path, not the one for your virtual environment. This is unfortunately not at all obvious and leads to very hard to track down bugs that seem to disappear and reappear if you aren't familiar with the issue.

I have a recipe here which always works: https://github.com/nlothian/m1_huggingface_diffusers_demo#se...

If you don't have requirements.txt then do this: `pip3 install jupyter` for that line, then `deactivate` and `source ./venv/bin/activate`.


I almost never rely on activating environments anymore. If it's in my project, I refer to it by its path relative to the project top level. If it's meant to be "global", I use Pipx, and if for some reason I can't, I use a script in ~/bin that uses the absolute path.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: