Setting up Jupyter with Python 3 on Ubuntu
Andrew B. Collier
A short note on how to set up Jupyter Notebooks with Python 3 on Ubuntu. The instructions are specific to Xenial Xerus (16.04) but are likely to be helpful elsewhere too.
Python Prerequisites
Make sure that you have python3
and pip3
installed.
$ sudo apt install python3
$ sudo apt install python3-pip
Also install the IPython shell.
$ sudo apt install ipython3
Install Jupyter
It’s then a simple matter to install Jupyter.
$ pip3 install jupyter
That installed the executables into ~/.local/bin/
, which then needs to be added to the execution path.
$ export PATH=$PATH:~/.local/bin/
It’s a good idea to add that to one of your startup scripts, probably .bashrc
.
Execution Time
At this stage you should be ready to roll.
$ jupyter notebook
That will open up a new Jupyter browser tab. From there you’ll be able to browse to find existing notebooks or create a new notebook by pressing the New
dropdown and selecting the notebook type.
Python 2 Kernel
The above instructions will give you a Python 3 kernel in Jupyter. What if you want to have Python 2 as another option? No problem!
$ python2 -m pip install ipykernel
$ python2 -m ipykernel install --user