3 ms·
had a ton of trouble getting jupyterlab to target an arbitrary virtualenv
by awinter-py 3y ago
had a ton of trouble getting jupyterlab to target an arbitrary virtualenv
- nl 3y agoThe 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#setup 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`.
- nerdponx 3y agoI 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.