I've created a Python venv and created a JupyterHub kernel based in it.
Everything works fine, I can start the kernel from JupyterHub interface and it is using my desired Python interpreter and venv.
The problem is that the directory with the global python
and pip
are first in the PATH variable.
When I try to run !pip install pandas
it finds the global pip
instead of my venv pip. If I run !which python
it finds my system python, instead of my venv python, so !python -m pip install pandas
also does not work.
I know that I can open a terminal, activate the venv and install my packages, but my users are confused. They are used to just run pip install in a notebook cell.
How to I make the command below work in my venv based kernel notebook?
!pip install some-package