Published on

IPython and Theano in Fedora with virtualenv


IPython notebook makes for a very productive print-ready advanced REPL. When combined with Theano, and other python datascience tools, it's almost unbeatable.

However, the installation instructions for each component are a little scattered, and this is an end-to-end explanation of what worked for me.

First steps (RPMs)

First, update the system so that the basics are there :

sudo yum update bash
sudo yum install python-virtualenv

Install interop and numerical RPMs

For 'pylearn2' and 'ipython notebook' :

sudo yum install libyaml-devel zeromq-devel

For SciPy :

sudo yum install openblas-devel atlas-devel gcc-gfortran

For matplotlib:

sudo yum install libpng-devel freetype-devel

Later, I'll be experimenting with OpenCL - and hope that Theano will be able to make use of CLBLAS, etc. (Fingers-crossed).

VirtualEnv setup

virtualenv env
. env/bin/activate

Python environment installation within the virtualenv, with bleeding-edge Theano and PyLearn2 :

pip install cython numpy

# This directory chosen as 'neutral'
cd env

  git clone git://
  cd Theano
    # By setting up 'develop', this directory becomes live in-place
    python develop
  cd ..

  git clone git://
  cd pylearn2
    # By setting up 'develop', this directory becomes live in-place
    python develop
  cd ..

cd ..

IPython notebook installation

Python environment installation within the virtualenv (apparently ipython installation on its own doesn't pull in the dependencies) :

pip install ipython pyzmq jinja2 tornado matplotlib

IPython notebook running

ipython notebook
# and open a browser to http://localhost:8888/

The 'magic' required to enable inline plotting by matplotlib with the IPython notebook is :

%matplotlib inline

Have fun!