The Jupyter Notebook allows you to share documents containing live code, equations, visualizations and explanatory text. Uses include: data processing, numerical simulation, statistical modeling, & machine learning etc. This post will guide you in setting up the platform and creating your first notebook.

Why Jupyter NoteBook ?

Conventionally data analysis tools like Matlab, Mapel, & Excel etc are insufficient for generating result documents (text, html, or pdf). Repeated manual efforts required in creating presentable results in a word processor makes data analysis a total loss.

IPython notebook cuts this issue by combining word processing with the data analysis tools. With Jupyter notebooks you’ve the ability to create content rich documents with embedded scientifc source code with very little effort.

In this post i’ll explain how to install IPython NoteBook and thereafter creation of NoteBooks

IPython NoteBook Installation

IPython Notebook is a component of IPython and is installed alongside IPython automatically. Many officially supported install methods can be found on IPython’s website at

IPython can be installed on Linux, Macintosh, and Windows. Single click installers are available and listed in the officially supported methods.

However, if you install IPython from source - you can have ability to easily change the version of your installation.

1. Get Python, Setup Tools & Dev Packages

You need python, use python --version to verify its installation. If not installed get it from Python Foundation.

You will also need to install the Python setup tools and dev packages. This can be done by running the following commands in the system terminal:

sudo apt-get update
sudo apt-get install python-dev python-setuptools

2. Get IPython & NoteBook Dependencies

IPython depends upon many open source packages which one must install. Also your notebook may’ve some additional dependencies which needs to be installed locally. For present example, such dependencies includes: pandoc, libzmq-dev, python-matplotlib, nose, tornado, jinja2, sphinx, & pyzmq.

Install them by running the following commands in the system terminal:

sudo apt-get install pandoc
sudo apt-get install libzmq-dev
sudo apt-get install python-matplotlib
sudo easy_install nose tornado jinja2 sphinx pyzmq

3. Install IPython NoteBook Engine

I’ll be explaining source code install method here (for its merit in ability to change version later on) over official method. To do so create a folder named ipython and git checkout its source code release from GitHub. Now to install IPython, run one of the following commands:

sudo python install (for python 2.x versions)


sudo python3 install (for python 3.x versions)

Use command ipython (for python 2.x) or ipython3 (for python 3.x) for accessing ipython binary. Notebook creation command will be ipython notebook. This will open a browser based editor for the same.

ANACONDA DataScience Platform

Just like Horton Works data science platform, I recommend you installing ANACONDA Data Science Platform. ANACONDA comes with Jupyter so no need for exclusive installation of ipython. IPython is python only implementation of Jupyter.

Here you can create notebooks using command jupyter notebook instead of ipython notebook.

ANACONDA Installation:

Download the installer, Around 455Mb. Open linux terminal and execute sudo bash (for python 3.5) or bash (for python 2.7).

ANACONDA CheatSheet:

OPEN CheatSheet

4. Install IPython Widgets

Powerful widgets like: ipyleaflet, bqplot, pythreejs and cookiecutter can be installed alongside. These widgets will provide following features to your notebooks:

  • iPyLeaflet: A library for creating simple interactive maps with panning and zooming.
  • BQplot: A 2-D interative data visualization library implementing the constructs of the grammar of graphics.
  • pyThreejs: A 3-D visualization library enabling GPU-accelerated computer graphics in Jupyter.
  • CookieCutter: The cookiecutter project helps widget authors get up to speed with the packaging and distribution of Jupyter interactive widgets.

You can install NoteBook Widgets using the instructions present in GitHub repository for these Widgets as shown:

iPyLeaflet BQplot pyThreejs CookieCutter

Working With IPython NoteBook

Use depricated ipython notebook or recommended jupyter notebook command to start notebook editor. The IPython Notebook dashboard will launch inside your default web browser displaying your home directory. The page will resemble the screenshot below:


Create your notebook by clicking the New Notebook button once you navigate to desired folder. The new notebook will resemble the screenshot below. Change the title of the notebook to “Tutorial1” by left clicking on “Untitled0” at the top of the page.

The notebook is composed of cells, each cell has its purpose based on its type and is shown as In [ ]. You can insert various types of cells based on your need and create wonderful scientific artices.


Header Cell

Use the first dropdown box in the toolbar (as seen below) to change first cell to Header. This will change the highlighted cell type to a level 1 header.


Modify your header markup, Press Shift+Enter to execute the current cell and move to the next one. If no cell exists below the current one, a new cell will be created. To insert a cell above or below the current cell, use the Insert menu.

Markdown Cell

Change new cell type to “Markdown” cell. In Markdown cells, you can create rich text using Dragon Markdown Syntax. It’s a powerful syntax that supports LeTeX and other features too.

Once done your page will look as shown below (note that markdown text is entered into 2nd cell)


IPython Cell

IPython has a set of magic commands that help the interactive programming process. Magic commands are prefixed with a single percent or double percent symbol. The pylab magic command automatically configures Python for plotting. Use the pylab magic command by entering the following into a code cell:

Create a new cell of type “Code” and enter magic command %pylab inline and your python code followed with Shift+Enter to see scientifc knowlegde in action. This code is as follows and output is shown in next figure

%pylab inline

x = linspace(0, 10)
y =sin(x)
plot(x, y)


Finally your notebook will look as shown in next image:


Sharing Your IPython NoteBooks

There are many methods to share your notebooks. The two most common methods are to: use IPython’s nbconvert to export the notebook as a redistributable format like HTML (one that can be rendered without IPython) or to upload and view it using IPython’s nbviewer.

You may like to first read my post Jupyter Notebook: An Introduction to get basic understanding on What is Jupyter, How to Share NoteBooks etc.

Exporting Your Notebook to HTML

Nbconvert can be used to export your newly created “Tutorial1” notebook to an HTML document. To do this, first open a terminal window and navigate to the directory where “Tutorial1” is saved. From this window, export the notebook by running the following command:

ipython nbconvert Tutorial1.ipynb

An HTML file will be created with the name “Tutorial1.html”. You may also click on URL below to directly view my NoteBook using free Jupyter NoteBook Viewer WebService