Explanations of how to install and use IPython Notebook with a venv and multiple virtualenv (one for Python 2 and one for Python 3).
We run step-by-step and detail all the operations. A quicker, more concise guide can be found at the end of this gist.
We create first one venv for each version of Python.
mkvirtualenv -p /path/to/python2.7 venv-name
deactivate
mkvirtualenv -p /path/to/python3.4 venv-name3
deactivate
Note: it is common practice to append a 3
at the end of your Python stuff that uses Python 3.
Install IPython Notebook in both virtualenv.
workon venv-name
pip install ipython[notebook]
deactivate
workon venv-name3
pip3 install ipython[notebook]
deactivate
Set the kernel specs for the corresponding Python versions. More details here.
workon venv-name
ipython kernelspec install-self
deactivate
workon venv-name3
ipython3 kernelspec install-self
deactivate
You can now run ipython notebook
from any of your venv. Switch the kernels in the Kernel > Change Kernel
menu of your Notebook. Please note that you'll need to install the libraries you need in the right venv, depending on which kernel you use.
We show a quicker, more concise installation, if you know what you are doing.
mkvirtualenv -p /path/to/python2.7 venv-name
pip install ipython[notebook]
ipython kernelspec install-self
deactivate
mkvirtualenv -p /path/to/python3.4 venv-name3
pip3 install ipython[notebook]
ipython3 kernelspec install-self
ipython notebook