In a project where I have to run some Jupyter notebooks, I created a virtual environment using pipenv and installed some packages (note that I used the --site-packages
flag).
Although now I am now able to run the notebooks with pipenv run papermill ...
, I cannot run them from Jupyter using pipenv run
or pipenv shell
because of some ModuleNotFoundError
exceptions.
In particular, the modules that are note found in the second case are the ones installed in the virtual environment only and not inherited from global-sites.
Indeed, if I check the sys.path
I can see the difference in the two cases: in the second there is no ~/.local/share/virtualenvs/...
entry.
Why am I having this issue and how can it be solved? (If possible, I would prefer not to pollute my ~/.local/share/jupyter/kernels
with other kernels from virtualenvs).