Differing IPython and Jupyter behaviour in virtualenvs
See original GitHub issueIt seems that the ~/.ipython/profile_default/startup/...
files are executed in a different environment depending on whether I invoke ipython
or jupyter console
in a virtualenv.
I have a Python package installed in my system site packages and in a virtualenv (in two different versions). If I invoke ipython
, it seems that sys.path
is adjusted for the virtualenv first before the startup file is executed and the correct package is loaded. However, with jupyter console
(also in the virtualenv) it seems that the startup file is executed (loading the wrong package in system site packages) and then the path is adjusted. Upon executing the first command it appears the startup file is executed again, but because the package was already loaded it won’t be replaced with the correct version.
Installing jupyter in the virtualenv fixes this problem, but I am wondering: What is the intended behaviour? (It would be convenient if it was not necessary to install jupyter in every virtualenv.) Is the different behaviour of the ipython
and jupyter
command intended?
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (7 by maintainers)
Top GitHub Comments
You can do it using a startup file - see ipython/ipykernel#96 for more discussion.
Sorry, It’s there any way to set jupyter notebook auto add the virtualenv to sys.path even if jupyter itself is installed outside virtualenv? Now, I just can sys.path.append(virtualenv path) to work around.