Python Juypter : Install

Python Juypter : Install

31 Mar 2020, 03:21pm TZ +05:30
Python, AppDevelopment, hardware, Juypter
tools, Software

Jupyter

Jupyter is great tool for Python development. It’s an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. It’s used for data cleaning, scrapping and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more. In-fact, I have already used it in some of my hardware projects.

Let’s Get this installed in our machines. And have some fun !

tl;dr #

1
2
3
4
5
6
7
sudo pacman -S python3 python-pip
sudo python3 -m pip install jupyter jupyter_contrib_nbextensions
...
mkdir ~/Documents/ipython-notebooks
cd ~/Documents/ipython-notebooks
...
jupyter notebook

Notebook Server at :

http://localhost:8888/tree
1
2
3
4
5
6
7
8
sudo apt update
sudo apt install python3 python3-pip
sudo python3 -m pip install jupyter jupyter_contrib_nbextensions
...
mkdir ~/Documents/ipython-notebooks
cd ~/Documents/ipython-notebooks
...
jupyter notebook

Notebook Server at :

http://localhost:8888/tree
1
2
3
4
5
6
pip install jupyter jupyter_contrib_nbextensions
...
mkdir "%UserProfile%\My Documents\ipython-notebooks"
cd "%UserProfile%\My Documents\ipython-notebooks"
...
jupyter notebook

Notebook Server at :

http://localhost:8888/tree

Though as per the documentation there are many ways specified. I feel directly installing it is better and faster.

Install Jupyter #

Jupyter is available as a Python Package. It can be installed for both Python 3 and it’s older versions.

We are only going to talk about Python 3 - looking towards future.

Let’s make sure we have Python 3 and pip installed.

Python typically comes already installed for Manjaro

We also need pip hence the command :

1
2
sudo pacman -S python3 python-pip
sudo python3 -m pip install jupyter jupyter_contrib_nbextensions

The installation is similar to Arch Linux.

1
2
3
sudo apt update
sudo apt install python3 python3-pip
sudo python3 -m pip install jupyter jupyter_contrib_nbextensions

You need to have Python3 Installed.

In a Command Prompt window give the command:

1
pip install jupyter jupyter_contrib_nbextensions

Note: The Add to PATH option needs to be checked when installing. Otherwise the pip command would not work not the Jupyter installation.

In Windows Install with Python3 with Add to PATH enabled

The last command above would install two important pieces.

  1. jupyter which brings the notebooks and all associated web functionality.
  2. jupyter_contrib_nbextensions which provides various addon features

Note(Linux): The sudo in front of the pip helps to install the packages to the system.

Create Workspace #

The notebook provides the interactive front-end and storage of programs.

The Jupyter notebook combines two components:

  • A web application: It’s a web server where we would be able to do the live code development.

  • Notebook documents: Its the program storage for the live code from the web application.

Jupyter Notebook documents contains the inputs and outputs of a interactive session as well as additional text that accompanies the code but is not meant for execution. In this way, notebook files can serve as a complete computational record of a session, interleaving executable code with explanatory text, mathematics, and rich representations of resulting objects. These documents are internally JSON files and are saved with the .ipynb extension. Since JSON is a plain text format, they can be version-controlled and shared with folks.

In order to store these Jupyter Notebook documents we would need to create a workspace. It’s basically a directory for storing the .ipynb files.

1
2
mkdir ~/Documents/ipython-notebooks
cd ~/Documents/ipython-notebooks
1
2
mkdir "%UserProfile%\My Documents\ipython-notebooks"
cd "%UserProfile%\My Documents\ipython-notebooks"

Run Jupyter #

Just make sure you are in the right directory.

Meaning the ipython-notebook directory.

Use the command

1
jupyter notebook

This should open your default Web Browser window.

In case it does not - Browse the following

http://localhost:8888/tree

In the command line you should see something like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[I 13:39:52.108 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.1
[I 13:39:52.109 NotebookApp] Serving notebooks from local directory: /home/<your-user-name>/Documents/ipython-notebooks
[I 13:39:52.109 NotebookApp] The Jupyter Notebook is running at:
[I 13:39:52.109 NotebookApp] http://localhost:8888/?token=deba5da4433babf610b6a24cdcd4bbc5e169d36d5098a4ae
[I 13:39:52.109 NotebookApp]  or http://127.0.0.1:8888/?token=deba5da4433babf610b6a24cdcd4bbc5e169d36d5098a4ae
[I 13:39:52.109 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 13:39:52.244 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/<your-user-name>/.local/share/jupyter/runtime/nbserver-211584-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=deba5da4433babf610b6a24cdcd4bbc5e169d36d5098a4ae
     or http://127.0.0.1:8888/?token=deba5da4433babf610b6a24cdcd4bbc5e169d36d5098a4ae
[I 13:41:08.687 NotebookApp] 302 GET /tree (127.0.0.1) 0.63ms

This one is for linux systems.

Note: The full token link shown at the end would open your Jupyter Notebook on any web browser.

Epilogue #

Hope that this installation would be useful. I found it mostly by experimentation.

Of course you can get the official documentation of Jupyter there.

Though its now called Jupyter Notebook. It’s due to newer project Jupyter-lab. This new project aims to create a complete online editor with IDE like look-and-feel. Enhancing the original Jupyter Notebook to the next level.

However in my opinion the Jupyter-lab is not stable yet. Hence I don’t recommend it. Also Anaconda side is good. But its very bulky and resource hungry. Go for it - if you only want do Professional Python.

Again its a matter of choice. I believe that being lean and easy is the core of Python. Possibly its that reason. Even after 10+ years of me writing the first print program, I am still using Python.