Building Numpy and Scipy on Ubuntu 12.04

This post should help you build Numpy and Scipy from source on Ubuntu 12.04.

If you already have a Numpy/Scipy installation from the Ubuntu repos, uninstall them.

$ sudo apt-get remove python-scipy python-numpy

Get the latest source from github.

$ git clone https://github.com/scipy/scipy.git

$ git clone https://github.com/numpy/numpy.git

Get all the needed tools to build Numpy, and Scipy. Except for cython which we will get next.

$ sudo apt-get install python-dev python-nose libblas-dev liblaplack-dev build-essential gfortran gcc

The cython in the ubuntu repos is too old to build Scipy with. So we add a ppa with a more recent version. Then update apt.

$ sudo apt-add-repository ppa:cython-dev/master-ppa
...
$ sudo apt-get update
...
$ sudo apt-get install cython

You need to build Numpy first.

$ cd ~/numpy
$ sudo python setup.py install
...

Then Scipy.

$ cd ~/scipy
$ sudo python setup.py install
...

Then try it out.

$ python

>>> import numpy
>>> import scipy

Comments

Comments powered by Disqus