How to install and execute Jupyter Notebook on Ubuntu 18.04

Image for post
Image for post

A little bit of retrospect first. In 2001 was created IPython, or Interactive Python, a command shell architecture for interactive computing in multiple programming languages, originally developed for the Python programming language [1]. The IPhyton kernel provides flexible and embeddable interpreters to load into projects and easy to use high performance tools for parallel computing [2].

Later in 2014, Project Jupyter was created as a spin-off from the IPhyton kernel. The notebook interface and other language-agnostic (language independent) parts of IPython were moved under the Jupyter name [3]. By default Jupyter Notebook ships with the IPython kernel but there are over 100 Jupyter kernels as of May 2018.

Fun fact, Jupyter is language agnostic and its name is a reference to core programming languages supported by Jupyter, which are Julia, Python, and R.

Checking your Python version

First of all, it’s good to check which python versions you have available in your system. To see the installed version, you can run the following command:

$ ls -ls /usr/bin/python*

The output should look something like this:

Image for post
Image for post

In my particular case I have 3 python versions installed, python 2.7, python 3.6 and python 3.8. Running purely $ python in the terminal yields the corresponding 2.x version of python. Also, running $ python3 yields the corresponding 3.x version of python.

Python versions

If you want to install a particular python version, let’s say, the latest python 3.8.2 version, we run the following command:

$ sudo apt-get install python3.8

Installing Jupyter Notebook — What didn’t work

To install Jupyter Notebook I inicially went to the official channels, like the official webpage of the Project Jupyter and the Jupyer documentation to look for installing tutorials. For my surprise they don’t use the same installing commands. In [6] $ sudo install notebook is required, while in [7] the listed command is$ sudo install jupyter. I tried both and they returned jupyter command not found when I ran$ jupyter notebook.

Image for post
Image for post
As mentioned, even installing ‘notebook’ and ‘jupyter’ wasn’t enough to run the jupyter environment.

Searching for this issue I found that other users had previously the same problem and luckily I also found a solution. The bad news is that the solution required another set of downloaded packages.

Installing and Executing Jupyter Notebook — What DID work

In the issue reported here a simple installing procedure is mentioned, I tried and it worked. The installing command is as follows:

$ sudo apt install jupyter-notebook

After finishing installing run the notebook with $ jupyter-notebook. Be aware for the ‘-’ character, because it is required to run the command. When you execute the command above a Jupyter interface will load in your browser with the notebook.

Image for post
Image for post
Jupyter running locally in the browser.

References

1. IPython: https://en.wikipedia.org/wiki/IPython

2. IPhyton: https://ipython.org

3. Project Jupyter: https://en.wikipedia.org/wiki/Project_Jupyter

4. IPhyton Overview: https://ipython.readthedocs.io/en/stable/overview.html

5. Language-agnostic: https://softwareengineering.stackexchange.com/questions/28484/what-is-language-agnosticism-and-why-is-it-called-that

6. Project Jupyter, install instructions: https://jupyter.org/install.html

7. Jupyter Documentation, install instructions: https://jupyter.readthedocs.io/en/latest/install.html

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store