<commit_before># How to Setup and use Jupyter and Ipython notebook on Ubuntu 14.04"

### Introduction

This article will talk you through setting up a server running Ipython and Jupyter notebook and teach you how to connect to and use the notebook app.  By the end of this tutorial, you will be able to use a Python 2.7 virtual environment, run Ipython and Jupyer noteobok and create and share reproducable code.  For the purposes of this tutorial, the walk through will be through using Python 2 (2.7.x) since many of the data science, scientific computing and high performance computing libraries support 2.7 and not 3.0+. 

IPython is an open sourced command shell which orginally developed for the Python Programming language which provides many features such as tab completion, history, interactive shells, browser-based notebook with support for code, text, mathematical expressions inline plots and many other features.  Project Jupyter is a spin off open sourced project which uses IPython as the kernel and provides a similar web notebook interface with support for Julia, R, Haskell and Ruby programming languages.  Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.  It is very useful as it enables rapid prototyping and reproducable code.  This tutorial will go over getting started with Ipython and Jupyter notebook.

This tutorial only uses open sourced software and package installers, namely apt-get and Pip.  Package installers are useful as they are small progams which made installing code convenient and managable.  Apt-get and Pip was useful as they allow to install open sourced software.  The offical Jupyter install tutorial suggests using the Anaconda distribution by Continuum Analytics which provides an installer and package management for many python packages. While being free to use (even for commercial), it is not fully open sourced and their script (.sh file) includes precompiled binary code.  Precompiled binary means that there was original source code used to generate the code you would be running.  It is not recommended to blindly use precompiled code since the content of the original source code is unknown and can create security flaws on your server.  For this reason is better to install packages on our own or using a fully open sourced package manager such as apt-get and Pip.

## Requirements

To get started, you will need a clean Ubuntu 14.04 server instance with a non-root user set up. The non-root user must be configured with sudo privileges. Learn how to set this up by following our [initial server setup guide](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04).

## Step 1 - Installing Python and Pip
First, update the system's package index. This will ensure that old or outdated packages do not interfere with the installation.

```command
sudo apt-get update
```

First let us install Python 2.7 and python-pip:

```command
  sudo apt-get -y install python2.7 python-pip
```

Installing `python2.7` will update python to the latest version of Python 2.7, and `python-pip` will install Pip which allows us to manage Python packages we would like to use.

## Installing Required Python Packages

By this point you should have Python 2.7 installed.  This can be checked using 

```command
  python --version
```

This will output:

```
  Python 2.7.6
```

Depending on the lastest version of Python 2.7, the output might be different (for example 2.7.7, 2.7.8 etc.)

You can also check if Pip is installed using the following command:

```commend
    pip --version
```

Which will output:

```
    pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
```






Next let us upgrade our python setup tools and install compilation requirements in python:

```
  pip install --upgrade setuptools
  pip install virtualenvwrapper
  pip install cython
  pip install nose

```
Now that we have all of the requirements, let us begin by installing the [SciPy stack](http://www.scipy.org/install.html)

```
  sudo apt-get -y install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose 

```
In the future you might also want to add the [NeuroDebian repository](http://neuro.debian.net/) for extra SciPy packages but for now let us move onto installing [Jupyter notebook](http://jupyter.org/):

```
  pip install jupyter

```
[Jupyer notebook](http://jupyter-notebook-beginner-guide.readthedocs.org/en/latest/what_is_jupyter.html) (or “notebooks”) are documents produced by the Jupyter Notebook App which contain both computer code (e.g. python) and rich text elements (paragraph, equations, figures, links, etc...). Notebook documents are both human-readable documents containing the analysis description and the results (figures, tables, etc..) as well as executable documents which can be run to perform data analysis.

Since some packages require matplotlib, we If you are on a Mac or Linux, and pip install matplotlib did not work, you are probably missing the supporting packages zlib, freetype2 and libpng. Let us install the requirements:

```
  sudo apt-get -y install libfreetype6-dev libpng12-dev libjs-mathjax fonts-mathjax libgcrypt11-dev libxft-dev

  pip install matplotlib

```
Next let us install the requirements for [Seaborn](http://stanford.edu/~mwaskom/software/seaborn/), then install Seaborn itself, which is a very powerful statistical plotting library:
  
```
  sudo apt-get install libatlas-base-dev gfortran

  pip install Seaborn

```
A very complimentary powerful statistics library is [statsmodels](http://statsmodels.sourceforge.net/)

```<commit_msg>more cleaning of content<commit_after># How to Setup and use Jupyter and Ipython notebook on Ubuntu 14.04"

### Introduction

This article will talk you through setting up a server running Ipython and Jupyter notebook and teach you how to connect to and use the notebook app.  By the end of this tutorial, you will be able to use a Python 2.7 virtual environment, run Ipython and Jupyer noteobok and create and share reproducable code.  For the purposes of this tutorial, the walk through will be through using Python 2 (2.7.x) since many of the data science, scientific computing and high performance computing libraries support 2.7 and not 3.0+. 

IPython is an open sourced command shell which orginally developed for the Python Programming language which provides many features such as tab completion, history, interactive shells, browser-based notebook with support for code, text, mathematical expressions inline plots and many other features.  Project Jupyter is a spin off open sourced project which uses IPython as the kernel and provides a similar web notebook interface with support for Julia, R, Haskell and Ruby programming languages.  Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.  It is very useful as it enables rapid prototyping and reproducable code.  This tutorial will go over getting started with Ipython and Jupyter notebook.

This tutorial only uses open sourced software and package installers, namely apt-get and Pip.  Package installers are useful as they are small progams which made installing code convenient and managable.  Apt-get and Pip was useful as they allow to install open sourced software.  The offical Jupyter install tutorial suggests using the Anaconda distribution by Continuum Analytics which provides an installer and package management for many python packages. While being free to use (even for commercial), it is not fully open sourced and their script (.sh file) includes precompiled binary code.  Precompiled binary means that there was original source code used to generate the code you would be running.  It is not recommended to blindly use precompiled code since the content of the original source code is unknown and can create security flaws on your server.  For this reason is better to install packages on our own or using a fully open sourced package manager such as apt-get and Pip.

## Requirements

To get started, you will need a clean Ubuntu 14.04 server instance with a non-root user set up. The non-root user must be configured with sudo privileges. Learn how to set this up by following our [initial server setup guide](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04).

## Step 1 - Installing Python and Pip
First, update the system's package index. This will ensure that old or outdated packages do not interfere with the installation.

```command
sudo apt-get update
```

First let us install Python 2.7, Python Pip, and Python Development:

```command
  sudo apt-get -y install python2.7 python-pip python-dev
```
Installing `python2.7` will update python to the latest version of Python 2.7, and `python-pip` will install Pip which allows us to manage Python packages we would like to use.  Since some of Jupyter’s dependencies may require compilation, in which case you would need the ability to compile Python C-extensions. This means a C compiler and the Python headers which is installed with `python-dev`

## Installing Required Python Packages

By this point you should have Python 2.7 installed.  This can be checked using the following command:

```command
  python --version
```

This will output:

```
  Python 2.7.6
```

Depending on the lastest version of Python 2.7, the output might be different (for example 2.7.7, 2.7.8 etc.)

You can also check if Pip is installed using the following command:

```commend
    pip --version
```

Which will output:

```
    pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
```
Now that we have all of the requirements, let us begin by installing the Ipython and Ipython Notebook

```
  sudo apt-get -y install ipython ipython-notebook
```
If you notice here, ipython and ipython-notebook is installed using apt-get not Pip.  This 


Now we can move onto installing Jupyter notebook:

```
  pip install jupyter

```
[Jupyer notebook](http://jupyter-notebook-beginner-guide.readthedocs.org/en/latest/what_is_jupyter.html) (or “notebooks”) are documents produced by the Jupyter Notebook App which contain both computer code (e.g. python) and rich text elements (paragraph, equations, figures, links, etc...). Notebook documents are both human-readable documents containing the analysis description and the results (figures, tables, etc..) as well as executable documents which can be run to perform data analysis.

Since some packages require matplotlib, we If you are on a Mac or Linux, and pip install matplotlib did not work, you are probably missing the supporting packages zlib, freetype2 and libpng. Let us install the requirements:

```
  sudo apt-get -y install libfreetype6-dev libpng12-dev libjs-mathjax fonts-mathjax libgcrypt11-dev libxft-dev

  pip install matplotlib

```
Next let us install the requirements for [Seaborn](http://stanford.edu/~mwaskom/software/seaborn/), then install Seaborn itself, which is a very powerful statistical plotting library:
  
```
  sudo apt-get install libatlas-base-dev gfortran

  pip install Seaborn

```
A very complimentary powerful statistics library is [statsmodels](http://statsmodels.sourceforge.net/)

```
{'fraction_non_alphanumeric': 0.05703488883030143, 'fraction_numerical': 0.00984269267949732, 'mean_word_length': 4.419047619047619, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2010590', 'n_tokens_mistral': 3105, 'n_tokens_neox': 2857, 'n_words': 1593}