This article explains how to install and use JupyterLab on Ubuntu Linux.
JupyterLab is a web-based interactive development environment allowing easy collaboration and sharing of code and data. It is flexible and can integrate third-party extensions that enhance its functionality.
Installing and using JupyterLab on Ubuntu Linux provides a powerful data analysis, visualization, and machine learning platform. It allows users to write and execute code, document their work, and share their findings with others.
Additionally, Ubuntu Linux is a popular data science and machine learning operating system, so installing JupyterLab on it can streamline the workflow for many users.
Prerequisites
Before installing JupyterLab, ensure that you have the following prerequisites installed:
- Python 3.x
- pip (Python package installer)
Update System Package Index
Open your terminal and begin by updating your system’s package index:
sudo apt update sudo apt upgrade
Install Python 3 and pip
If Python 3 is not already installed on your system, you can install it using the following command:
sudo apt install python3 python3-pip python3-venv nodejs
After installing, check the version of Python and pip:
python3 --version pip3 --version
Install JupyterLab
With Python and pip ready, you can install JupyterLab via pip. First, create a new Python virtual environment for the Jupyter installation.
With this scenario, you will have an isolated development environment that won’t affect your whole system.
Create a new directory for your project called MyLab and change into the folder using the cd command.
Then, use the following command to create a new virtual environment called venv. The new directory venv will be created after the command is executed.
mkdir -p ~/MyLab cd ~/MyLab python3 -m venv venv source venv/bin/activate
After creating the virtual environment above, run the command below to install JupyterLab.
pip3 install jupyterlab
Once the installation is completed, JupyterLab will be ready to use.
Run JupyterLab
To start JupyterLab, run the following command in your terminal:
jupyter-lab
This should open your default browser and launch JupyterLab. Alternatively, if it doesn’t open automatically, you can manually visit the URL it provides, usually something like http://localhost:8888/lab
.

Create a New Notebook
In the JupyterLab interface,
- Click the “+” button to open a new tab.
- Under the “Notebook” section, you can create a notebook in different programming languages, depending on your installed kernels. Choose a Python 3 notebook to create a new one.
Use the Notebook
Once your notebook is open, you can start typing Python code into the cells. Press Shift + Enter
to execute the code in the current cell.
Here’s an example of a simple print statement:
print("Hello, JupyterLab!")
Saving and Exiting
To save your notebook, press the save icon or go to File -> Save Notebook
. To close JupyterLab, simply close the browser tabs and stop the server by pressing Ctrl + C
in the terminal where it’s running.
Uninstall JupyterLab (Optional)
If you wish to remove JupyterLab from your system, you can do so using pip:
pip3 uninstall jupyterlab
Confirm the uninstallation when prompted.
Conclusion:
- JupyterLab offers a powerful environment for data analysis, visualization, and machine learning
- Explore the features of JupyterLab and consider installing extensions to enhance your experience
- Consider JupyterLab as a valuable tool for collaborative work and efficient workflow in data-centric tasks
Leave a Reply