How to Install Jupyter On Debian 9


Jupyter Notebook is a robust web-based application that allows you to create and distribute documents containing equations, live code, narrative text, and visualizations. It's a powerful, open-source software that is designed for multiple use cases including statistical modeling, numerical simulation, machine learning, and data visualization.

Besides, the platform can be used in a number of languages such as Julia, Ruby, Haskel, R, and Python.

This guide will help you install Jupyter Notebook on your Debian 9 server. We’ll also show you how to configure this application for Python 3.

Assuming you have Python hosting (i.e., web hosting that supports Python well) or hosting that supports the language you're setting Jupyter up for (e.g., R),  let’s get started!

Before You Begin

For this installation to work flawlessly, the following must be in place before you begin:

  • A Web hosting account
  • A fully configured Debian 9 server

Step 1 - Installing Python 3 And Pip

The first step, when installing Jupyter Notebook on your Debian 9 server is updating your local apt package index:

$ sudo apt update

Next, run the command below to install Python 3 header files as well as Pip; a reliable Python package manager:

$ sudo apt install python3-pip python3-dev

Note: Your Debian 9 server is preinstalled with the Python 3.5.

Once you install these components, run the command below to confirm the version of the Python installed:

$ python3 --version

This will give you an output similar to the one below:

Python 3.5.3

Next issue the command below to check Pip:

$ pip3 --version

This will give you the output below:

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

Now, proceed with the installation and create the virtual environment where Jupyter will be installed.

Step 2 - Creating The Virtual Environment

By now, Pip, Python 3 headers, and Python 3 itself are already installed in your server. You can now proceed and creating the Python virtual environment where Jupyter Notebook will be installed.

First, run the command below to upgrade Pip:

$ sudo -H pip3 install --upgrade pip

If everything is okay, you will get the output below:

Found existing installation: pip 9.0.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outsideenvironment, user
Successfully installed pip-18.1

Then issue the command below to install virtualenv:

$ sudo -H pip3 install virtualenv

This will give you the output below:

Installingcollectedpackages: virtualenv

Now, you can start creating the Python virtual environment. Run the command below to create a directory called, myprojectdir, then change to this directory:

$ mkdir ~/myprojectdir
$cd ~/myprojectdir

This is the directory where all project files will be kept. Within this directory, execute the command below to create the Python virtual environment:

$ virtualenv myprojectenv

This will prompt the creation of a new directory; myprojectenv within the myprojectdir directory. Then inside this directory (myprojectenv) both pip and Python will be installed in their local versions. You can now utilize this to set up a separate Python environment for the Jupyter application.

Before you install Jupyter, run the command below to active Python virtual environment:

$source myprojectenv/bin/activate

The prompt will change and show you are working within the Python virtual environment. You will have the shell commands prefixed by something like:


You can proceed to the next step:

Step 3 - Installing And Running Jupyter

By now everything is set and it should be easy to install Jupyter. Here you will use the Python package manager; pip to install Jupyter. Simply issue the command below to accomplish this:

$ pip install jupyter

This will automatically install the software required to operate Jupyter Notebook. To run the application, execute the command below:

(myprojectenv)user@host:~/myprojectdir$ jupyter notebook

This will print a list of Jupyter Notebook activities as shown below:

[I 21:23:21.198 NotebookApp] Writing notebook server cookie secret to /run/user/1001/jupyter/notebook_cookie_secret
[I 21:23:21.361 NotebookApp] Serving notebooks from local directory: /home/sammy/myprojectdir
[I 21:23:21.361 NotebookApp] The Jupyter Notebook is running at:
[I 21:23:21.361 NotebookApp] http://localhost:8888/?token=1fefa6ab49a498a3f37c959404f7baf16b9a2eda3eaa6d72
[I 21:23:21.361 NotebookApp] Use Control-C tostop this serverand shut down all kernels (twice toskip confirmation).
[W 21:23:21.361 NotebookApp] No web browser found: could notlocate runnable browser.
[C 21:23:21.361 NotebookApp]

    Copy/paste this URLinto your browser when you connectfor the firsttime,
    to login with a token:


That is all! You have successfully installed, configured, and even started Jupyter Notebook on your Debian 9 server.

There are many things that you can do from this point, but the most crucial thing is learning how to use your newly installed application and how to connect it to your server via SSH tunneling.

Check out these top 3 Best web hosting services

Was this article helpful?