Installing Jupyter Notebook on Ubuntu 22.04: A Step-by-Step Guide
This page is originally posted on:
https://ashari.me/posts/installing-jupyter-notebook-on-ubuntu-22-04-a-comprehensive-guide
Jupyter Notebook is an open-source web application that facilitates the creation and sharing of documents containing live code, equations, visualizations, and narrative text. It is widely used for data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, etc.
Prerequisites
Ensure you have Python installed on your machine. Jupyter Notebook supports Python 3.3 or later. You can install Python 3 by executing:
sudo apt update
sudo apt install python3
Step-by-step
Step 1: Install pip
pip
is a package manager for Python. It's used to install and manage Python libraries. Execute the following command to install pip for Python 3:
sudo apt install python3-pip
Step 2: Upgrade pip (Optional)
It’s a good practice to have the latest version of pip. Upgrade pip using the following command:
pip3 install --upgrade pip
Step 3: Install Jupyter Notebook
Now, install Jupyter Notebook using pip:
pip3 install notebook
Step 4: Start and Access Jupyter Notebook
Launch Jupyter Notebook by executing the following command:
jupyter notebook
Jupyter Notebook will start, and your web browser will open displaying the Notebook dashboard. If it does not open automatically, open your web browser and type the following URL:
http://{your-ip}:8888/
In the terminal, Jupyter will provide a URL that includes a token, which is a type of temporary password to access the Jupyter Notebook. If the browser does not open automatically, copy and paste this URL into your browser’s address bar to access the Jupyter Notebook web interface. The URL will look something like this:
http://{your-ip}:8888/?token=YOUR_TOKEN_HERE
Replace YOUR_TOKEN_HERE
with the actual token displayed in your terminal.
Now, you should see the Jupyter Notebook interface, where you can create new notebooks, open existing notebooks, or manage your files.
Step 5: Install Additional Libraries and Dependencies (Optional)
Jupyter Notebook is now ready to use. However, depending on your use case, you might want to install additional libraries such as NumPy, Pandas, and Matplotlib, which are commonly used with Jupyter Notebook.
pip3 install numpy pandas matplotlib
Wrapping Up
You have successfully installed Jupyter Notebook on Ubuntu 22.04 and optionally some additional libraries. Now you can create new notebooks, and start working on your projects. Whether it’s data analysis, machine learning, or any other data science task, Jupyter Notebook provides a robust and interactive environment for all your needs.