Install up-to-date scientific environment in Ubuntu 14.04 with Python 3.4

Note: I’ve created an updated page with most recent instructions for Jupyter Notebook.

I use IPython notebook for processing numerical experiments results and plotting. The default Python 3 in Ubuntu 14.04 is 3.4, so it is easier to install really up-to-date bunch of software.

Full set of commands you need to install recent ipython notebook, numpy, scipy, etc in virtual environment almost without affecting shiny-new Ubuntu 14.04.

#!/usr/bin/env bash

sudo su
# install python development packages and g++
apt-get install -y python3-dev g++

# install dependencies for scipy
apt-get install -y libblas-dev liblapack-dev gfortran

# install dependencies for matplotlib
apt-get install -y libfreetype6-dev libpng-dev

# ipython notebook has bug:

python3 -m venv --clear --without-pip venv/ipython-notebook

# activate virtual env and install pip
source venv/ipython-notebook/bin/activate


# install scientific packages
pip install numpy sympy matplotlib scipy pandas

# install ipython notebook and dependencies
pip install ipython pyzmq jinja2 pygments bokeh

# install latest dev scikit-learn and build it
pip install cython

# install prettyplotlib by Olga Botvinnik for beauty plots
pip install brewer2mpl prettyplotlib

# deactivate venv

Now create profile for ipython notebook and change there some settings. Activate virtual environment:

bikulov@kbux:~$ source venv/ipython-notebook/bin/activate

Generate password and exit ipython:

from IPython.lib import passwd; passwd()

Copy password hash to clipboard. Create profile with desired name:

ipython profile create [name]

Open ~/.ipython/profile_[name]/ and change settings:

c.NotebookApp.port = 8888
c.NotebookApp.ip = ''
c.NotebookApp.open_browser = False
c.NotebookApp.password = [password hash]

Start ipython notebook server:

ipython notebook --profile=[name]

And open in your browser.