How to Install Jupyter On Debian 9

How to Install Jupyter On Debian 9

Introduction

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
Successfullyinstalledvirtualenv-16.1.0

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:

(myprojectenv)user@host:~/myprojectdir$

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:
        http://localhost:8888/?token=1fefa6ab49a498a3f37c959404f7baf16b9a2eda3eaa6d72

Conclusion

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

Hostinger
$2.99 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7
IONOS
$1.00 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
Ultahost
$2.50 /mo
Starting price
Visit Ultahost
Rating based on expert review
  • User Friendly
    4.3
  • Support
    4.8
  • Features
    4.5
  • Reliability
    4.0
  • Pricing
    4.8

How to Install Jupyter Notebook on Ubuntu 18.04 VPS Or Dedicated Server

This tutorial will show you how to install Jupyter Notebook on your Ubuntu 18.04
less than a minute
David Malcom
David Malcom
Author

How to Install the Django Web Framework on a Ubuntu 22.04 VPS

Brief description When building a website, similar components are required, and
less than a minute
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Create a Dynamic Web App with Django

Overview As a “batteries included” framework, Django
less than a minute
Mark Armistead
Mark Armistead
Author

Use Python to Automate Routine Tasks on Your VPS or Dedicated Server

Here we'll use basic knowledge of Python to teach you how to leverage the extrao
less than a minute
Md. Ehsanul Haque Kanan
Md. Ehsanul Haque Kanan
Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top