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.
In this write-up, we'll elaborate on stepwise instructions needed to install Jupyter on Ubuntu 22.04.
Before proceeding with the installation, you must fulfill the below-listed requirements:
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.Jupyter (also known as IPython Notebook) provides numerous benefits, making it highly popular in data science, machine learning, and coding education:
Overall, its versatility and intuitive attributes make it an excellent application for anyone looking to boost their coding, learning, and collaboration experience.
Setting up Jupyter Notebook on Ubuntu 22.04 requires a few simple steps to get it running:
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:
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:
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
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
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:
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:
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:
To access Jupyter, copy the above-highlighted URL and paste it into your computer browser:
Browse the New panel available on the dashboard, expand the dropdown menu, and select Python3 (ipykernel):
Once your Jupyter notebook is good to use, specify your code, and press Shift + Enter to execute the script:
print("Welcome to Hostman!")
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.
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.
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
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
This process ensures that Jupyter is entirely removed, leaving no leftover files in the system.
Below are some effective tips for configuring and operating Jupyter Notebook on Ubuntu:
pip
are properly installed.pip
have been updated to the newest versions.pip
to install Jupyter inside the virtual environment to efficiently handle required dependencies.Executing these practices guarantees a precise setup and an efficient and productive platform for coding, analytical work, and research projects.
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.