Translate

How to Install Jupyter Notebook on Ubuntu 20.04 / 18.04

 

How to Install Jupyter Notebook on Ubuntu 20.04 / 18.04

How to install Jupyter Notebook on Ubuntu 20.04 to share live code with others. In this guide, we’ll show you how to Install Jupyter Notebook on Ubuntu 20.04 LTS. Here we show you simple ways to install Jupyter on Ubuntu 20.04 LTS (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04 and any other Debian based distribution like Linux Mint and Elementary OS.

Jupyter Notebook is an open-source web application that allows you to create and share live code documents with others. Jupyter is a next-generation notebook interface. Jupyter supports more than 40 programming languages including Python, R, Julia, and Scala.

Install Jupyter Notebook on Ubuntu

The following steps to install Jupyter Notebook on your Ubuntu systems.

Step 1 Update and Upgrade Packages

First, we always start our installations before we ensure our system is updated. Run the following command to update the APT list of available packages and their versions. Moreover, use the upgrade command to actually install newer versions of the packages.

sudo apt update && sudo apt -y upgrade
Bash

Step 2 Install Python

Next you have to install Python 3, pip, and other required packages to build Python dependencies.

sudo apt install python3-pip python3-dev
Bash

Step 3 Install Python virtualenv

Upgrade pip version and install Python virtualenv package.

sudo -H pip3 install --upgrade pip
sudo -H pip3 install virtualenv
Bash

Note: Here, -H stands for security policy to set the home environment variable.

Step 4 Create Python Virtual Environment

First you have to create a directory in your home directory (or any other location). This new directory is considered our code directory.

mkdir notebook
Bash

Next you have to go to the directory and create a Python virtual environment called jupyterenv.

cd notebook
virtualenv jupyterenv
Bash

Now we have to load and activate the virtual environment using the following command.

source jupyterenv/bin/activate
Bash

Step 5 Install Jupyter Notebook

Write down the following command in your terminal to install Jupyter using pip.

pip install jupyter
Bash

Step 6 Run Jupyter Notebook

We have installed all required packages and dependencies. Let’s start to run the Jupyter Notebook. Run the following command.

jupyter notebook
Bash

Here is a home screen of Jupyter.

jupyter notebook homescreen

You have to click on the new menu and select Python3 or else you can select another option. It will create a new page in your browser of Jupyter.

Jupyter Notebook Page

Step 7 Create Jupyter Application Menu

Create a new file called run-jupyter.sh in your notebook directory.

#!/bin/bash

source /home/username/jupyterenvironment/bin/activate
jupyter notebook

Create a new file in /usr/share/applications called jupyter.desktop to create an application menu item.

[Desktop Entry]
Name=Jupyter Notebook
Exec=/home/username/notebook/run-jupyter.sh
Type=Application
Terminal=true
Markup

We hope you have found this article helpful. Let us know your questions or feedback if any through the comment section in below. You can subscribe our newsletter and get notified when we publish new articles. Moreover, you can explore here other interesting articles.

Comments

Popular Posts

bot

Popular post