In this article, we would discuss how to install and setup Jupyter Notebook for Python programming language in Ubuntu. A Jupyter Notebook enables us to have a browser-based REPL (read-evaluate-print-loop) shell. It supports many programming languages including Python, R, Haskell and Julia. Through Jupyter Notebook, we can run our code & store its output in a notebook. The extension of the saved notebook, a JSON file, is
.ipynb. Furthermore, there are three main components of a Jupyter Notebook – browser, notebook server, kernel.
- The Browser acts as the front-end, it is the one with which user interacts.
- Notebook server handles the notebook files. It allows us to save, edit and load notebook files.
- Kernels are available for numerous programming languages. Hence, if we don’t have kernel for a particular programming language then we can’t run its code.
We would install Jupyter Notebook through PIP3. So, in case you haven’t installed it yet in your Ubuntu distribution then check the article – Install PIP in Ubuntu 19.10
Install and Setup Jupyter Notebook for Python
After we have installed PIP3 in Ubuntu, we should use its upgraded version if available. Therefore, issue the following in terminal –
sudo pip3 install --upgrade pip
Next, for Jupyter Notebook –
sudo pip3 install jupyter
It will return with Successfully installed message for various packages.
Now, there are two ways to launch Jupyter Notebook. Use either of the following methods –
- Through Command-line interface: Issue the following command in terminal to launch Jupyter Notebook –
- From the browser itself: Launch the web-browser and visit the following link –
localhost is your hostname and,
8888 is the port number.
We will be taken to Jupyter dashboard through our web-browser. In the right-corner, click on New and you should see Python 3 if everything has been working fine.
In conclusion, we have discussed how to install and setup Jupyter Notebook for Python in Ubuntu distribution.