Learning Center
Ubuntu

How to Install Jupyter Notebook on Ubuntu 22.04

14 Feb 2025
Anees Asghar
Anees Asghar

Jupyter Notebook is a free and open tool that enables users to generate engaging files to script and run code, render mathematical expressions, show graphs, and add explanatory text. It's extensively applied in data science, machine learning, and academic research. Ubuntu 22.04 users can install Jupyter Notebook efficiently with minimal effort.

And if you’re looking for a reliable, high-performance, and budget-friendly solution for your workflows, Hostman has you covered with Linux VPS Hosting options, including Debian VPS, Ubuntu VPS, and VPS CentOS.

In this write-up, we'll elaborate on stepwise instructions needed to install Jupyter on Ubuntu 22.04.

System Requirements
Copy link

Before proceeding with the installation, you must fulfill the below-listed requirements:

  • Ubuntu 22.04 must be properly set up and running.
  • Jupyter relies on Python3, which is generally included in most Linux distributions. Verifying its presence by executing the python3 --version command in the terminal.
  • pip serves as the package manager for Python and is necessary for installing Jupyter Notebook and other libraries. So, verify the pip’s installed version before proceeding.

Key Advantages of Jupyter
Copy link

Jupyter (also known as IPython Notebook) provides numerous benefits, making it highly popular in data science, machine learning, and coding education:

  • It enables real-time coding and execution, simplifying debugging and testing.
  • Although primarily designed for Python, it also supports other languages such as R and Julia.
  • We can incorporate notes, formulas, and visualizations (like charts and graphs) alongside our code, making it easy to explain our work. 
  • It integrates code, comments, and outputs in one document, so it's easy to share and collaborate with others. 
  • You can even add extra features and widgets to make your work more interactive. Moreover, it helps us keep a clear record of our steps, making it simple for others to follow or reproduce our work.

Overall, its versatility and intuitive attributes make it an excellent application for anyone looking to boost their coding, learning, and collaboration experience.

Installing Jupyter on Ubuntu 22.04
Copy link

Setting up Jupyter Notebook on Ubuntu 22.04 requires a few simple steps to get it running:

Upgrade Your System
Copy link

Before adding any new programs, it's advisable to refresh repositories:

sudo apt update && sudo apt upgrade -y

This command refreshes all the installed packages to their latest available versions, with the -y flag automatically confirming the action:

Image1

Python3 and Pip Installation
Copy link

If Python3 and pip are not set up in your system yet, you can install them by employing the below-given commands:

sudo apt install python3 -y #Install Python3
sudo apt install python3-pip -y #Install pip for Python3

To demonstrate that pip is set up properly, check its version using the given command:

pip3 --version

The resultant screenshot indicates that pip 22.0.2 is appropriately installed on the system:

Image3

Preparing a Virtual Environment
Copy link

Once Python3 is installed, you can set up a virtual environment. First, let’s install venv module for Python that enables us to create virtual environments:

sudo apt install python3.10-venv

After this, create a new directory named hostman by employing the command:

mkdir hostman

Let’s navigate to the newly created project directory by running the cd command:

cd hostman

Now we can create a virtual environment where Jupyter Notebook can be installed:

python3.10 -m venv jupyterNotebook-venv

Once the environment is established, enable it by running:

source jupyterNotebook-venv/bin/activate

Image2

Installing Jupyter/IPython
Copy link

Once Python and pip are appropriately installed, we can proceed with the Jupyter installation.

Before moving ahead, we need to update pip3 to the most recent version:

pip install --upgrade pip

Image5

Next, execute the given command to install Jupyter alongside its associated dependencies:

pip3 install jupyter

The image demonstrates that Jupyter Notebook is properly installed alongside all essential components:

Image4

Confirm Jupyter Installation Status
Copy link

To check the installation status of Jupyter on your Ubuntu system, confirm its version:

jupyter --version

It retrieves the installed Jupyter version alongside other corresponding components, including JupyterLab and Jupyter_Server, if available:

Image7

How Jupyter Works
Copy link

Once the setup is finished, run the Jupyter Notebook utilizing the command:

jupyter notebook

This will kick off the Jupyter server and provide a response that resembles the following:

Image6

To access Jupyter, copy the above-highlighted URL and paste it into your computer browser:

Image9

Notebook Setup
Copy link

Browse the New panel available on the dashboard, expand the dropdown menu, and select Python3 (ipykernel):

Image8

Script Execution
Copy link

Once your Jupyter notebook is good to use, specify your code, and press Shift + Enter to execute the script:

print("Welcome to Hostman!")

Image12

Installing Jupyter through Anaconda
Copy link

Anaconda offers a simple and efficient method to install the Jupyter Notebook. If Anaconda is preinstalled on our machine, we can proceed with the Jupyter’s installation/setup by typing the given command:

conda install jupyter

It automatically downloads and installs Jupyter alongside necessary dependencies, making sure it’s good to use without requiring an additional setup process.

Installing JupyterLab on Ubuntu
Copy link

JupyterLab presents a dynamic and adaptable platform for handling notebooks, writing code, and analyzing data. It functions as an advanced variant of the Jupyter Notebook, offering a more customizable and feature-rich experience. JupyterLab efficiently organizes multiple notebooks, code consoles, and various documents within a tabbed layout. It also supports real-time coordination/collaboration, easy file navigation, and integrates with multiple development tools, making it ideal for handling complex tasks.

While Jupyter is great for simpler tasks, JupyterLab offers a more advanced experience. To begin utilizing JupyterLab, we must first install it on our system with the below-provided command:

pip3 install jupyterlab

After completing the installation, we can access JupyterLab by employing this command:

jupyter-lab

It will commence JupyterLab in our browser, which presents a more advanced interface for managing notebooks.

Uninstalling Jupyter From Ubuntu
Copy link

If Jupyter is no longer required, you can uninstall it effortlessly. Employ this command to remove Jupyter alongside its associated dependencies:

pip3 uninstall jupyter -y

Image10

To completely remove Jupyter, including stored settings, cached data, and user configurations, delete the associated files and directories:

rm -rf ~/.jupyter
rm -rf ~/.local/share/jupyter

Image11

This process ensures that Jupyter is entirely removed, leaving no leftover files in the system.

Effective Ways to Optimize Jupyter Notebook Usage
Copy link

Below are some effective tips for configuring and operating Jupyter Notebook on Ubuntu:

  • Before installation, update your system and confirm that Python3 and pip are properly installed.
  • Utilize a virtual environment to maintain an efficient, dedicated environment and prevent conflicts with other Python projects.
  • To avoid compatibility concerns, make sure that Python and pip have been updated to the newest versions.
  • Utilize pip to install Jupyter inside the virtual environment to efficiently handle required dependencies.
  • If you need a more advanced interface with enhanced features such as real-time collaboration and file management, consider installing JupyterLab instead of Jupyter Notebook.

Executing these practices guarantees a precise setup and an efficient and productive platform for coding, analytical work, and research projects.

Final Thoughts
Copy link

Jupyter or IPython Notebook is an essential medium for developers, researchers, and learners working with coding and data analysis. Its capability to seamlessly integrate code, graphs, and explanations into a single document makes it a perfect choice for collaborative work and educational purposes.

Installing Jupyter on Ubuntu 22.04 is simple, and by implementing the instructions demonstrated in this post, you can quickly set up a productive workspace. Additionally, utilizing best practices such as using a virtual environment and keeping Python and pip updated helps maintain a seamless experience.