How to Install Jupyter Notebook Using pip – A Complete Guide

Jupyter Notebook is one of the most popular tools for data science, machine learning, and Python development. It offers an interactive environment where you can write code, run it in real-time, visualize data, and document your analysis all in one place. While there are many ways to install Jupyter, using pip is the most straightforward and flexible method—especially for developers who prefer working with virtual environments. In this guide, you’ll learn how to install Jupyter Notebook using pip step-by-step, along with tips for environment management, troubleshooting, and verifying the installation.

What Is Jupyter Notebook?

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It supports over 40 programming languages, with Python being the most commonly used. It’s widely adopted in data science, academic research, machine learning, and analytics projects due to its flexibility and ease of use.

Why Install Jupyter Notebook Using pip?

Here are a few advantages of installing Jupyter Notebook using pip:

  • Lightweight Installation: Only installs the components you need.
  • Custom Environments: Easily manage dependencies using venv or virtualenv.
  • Cross-Platform: Works consistently on Windows, macOS, and Linux.
  • Control: Avoids bloated distributions like Anaconda if you prefer granular control over packages.
  • Better CI/CD Support: Ideal for automated deployment and scripting.

Prerequisites

Before installing Jupyter using pip, you need to have Python and pip installed. You can check if Python is installed by running:

python --version

Or for some systems:

python3 --version

To check if pip is installed:

pip --version

If pip is not installed, you can install it using:

python -m ensurepip --upgrade

For the best practice, you should also use a virtual environment.

Step 1: Create a Virtual Environment (Recommended)

It’s always a good idea to create a virtual environment to isolate your project dependencies.

To create one using venv, run:

python -m venv jupyter_env

This will create a folder named jupyter_env.

To activate it:

  • On macOS/Linux:
source jupyter_env/bin/activate
  • On Windows:
jupyter_env\Scripts\activate

Your terminal prompt should now indicate that the virtual environment is active.

Step 2: Install Jupyter Notebook Using pip

With the virtual environment activated, run the following command to install Jupyter Notebook:

pip install notebook

This command installs the Jupyter server and notebook frontend, along with its required dependencies like tornado, ipykernel, and traitlets.

Once installation is complete, verify it by checking the version:

jupyter notebook --version

You should see output like:

6.5.4

Note that version numbers may vary based on the latest release.

Step 3: Launch Jupyter Notebook

Now that Jupyter is installed, launch the notebook server using:

jupyter notebook

This will start a local web server and automatically open your default browser at the URL http://localhost:8888/tree.

From here, you can:

  • Create a new Python notebook
  • Open existing .ipynb files
  • Write and run code cells
  • Add markdown cells for notes and documentation

If your browser doesn’t open automatically, copy the URL shown in your terminal and paste it into your browser manually.

Step 4: Install Additional Kernels (Optional)

Jupyter supports multiple languages via kernels. By default, it uses the IPython kernel, which runs Python.

If you want to create notebooks with other environments, you can install additional kernels. For example, if you create a new virtual environment named ml_env, you can add it to Jupyter like this:

pip install ipykernel
python -m ipykernel install --user --name=ml_env --display-name "Python (ml_env)"

This makes the environment available in the “Kernel” selection menu inside the notebook interface.

Step 5: Installing Common Data Science Packages

You may want to install useful packages for data analysis and machine learning:

pip install numpy pandas matplotlib seaborn scikit-learn

Once installed, you can import and use them inside your notebooks.

Here’s a quick example:

import pandas as pd
import matplotlib.pyplot as plt

data = pd.DataFrame({
"x": range(10),
"y": [i**2 for i in range(10)]
})

data.plot(x="x", y="y", kind="line")
plt.title("Simple Plot")
plt.show()

This creates a simple line graph of a quadratic function.

Step 6: Save, Export, and Share Notebooks

Jupyter allows you to save notebooks as .ipynb files. You can also export them as:

  • HTML
  • PDF
  • Markdown
  • Python scripts

To do this:

  • Go to File > Download as
  • Select the desired format

This makes it easy to share reports, collaborate with teammates, or submit assignments.

Step 7: Run Notebooks in VSCode or Other Editors

If you prefer not to work in a browser, you can also run Jupyter Notebooks in Visual Studio Code.

To do this:

  • Install the Python and Jupyter extensions in VSCode
  • Open the .ipynb file
  • Select the kernel from the top right
  • Run cells just like in the browser-based notebook

This setup provides IntelliSense, Git integration, and a smoother developer experience.

Step 8: Troubleshooting Tips

Here are some common issues and solutions:

  • Command not found: Ensure jupyter is in your PATH. If you’re in a virtual environment, make sure it’s activated.
  • ImportError: If a module is missing, install it using pip.
  • Browser not launching: Copy the URL printed in the terminal and paste it into your browser manually.
  • Kernel not appearing: Check if ipykernel is installed and the environment is properly registered.

Step 9: Uninstall or Upgrade Jupyter

To uninstall Jupyter:

pip uninstall notebook

To upgrade it:

pip install --upgrade notebook

Make sure to update ipykernel, jupyterlab, and any other related packages if you’re maintaining a full-featured setup.

Step 10: Alternatives and Extensions

For more advanced use cases, consider exploring:

  • JupyterLab: A more powerful interface with tab support and drag-and-drop features.
  • nbextensions: Add interactive widgets, code folding, spell checking, and more.
  • Voila: Turn your notebooks into standalone interactive dashboards.
  • Binder: Share your notebooks online with reproducible environments.

To install JupyterLab:

pip install jupyterlab

Launch it using:

jupyter lab

It runs on the same Jupyter server but offers a modern UI.

Conclusion

Installing Jupyter Notebook using pip is a lightweight, efficient, and customizable way to set up your Python development environment. Whether you’re analyzing data, building models, or sharing insights, Jupyter provides a flexible and interactive platform to do it all. With pip and virtual environments, you have full control over your dependencies and project setup, making your workflow clean and reproducible. By following the steps above, you’ll be ready to harness the full power of Jupyter Notebook in your daily development routine.

Leave a Comment