Install NumPy and SciPy on Ubuntu
On Ubuntu 11.10, here is what I had to do:
sudo pip install numpy sudo apt-get install libatlas-base-dev gfortran sudo pip install scipy sudo pip install matplotlib # recommended
Line 2 was necessary for SciPy, otherwise it was complaining that BLAS and a Fortran compiler were missing. Note that gfortran
replaces the package g77
.
In the old days I used to just use synaptic package manager to install such things. It seems like a bit of a retrostep for Ubuntu to be pushing us away from GUIs and back to command prompt. Yes, yes, I know command prompt is not so bad, but neither was synaptic! And even installing synaptic can’t be done via the software centre. Does anyone understand why this is?
Actually I don’t have a “pip” command either, so I’m still struggling to figure out how to do something that used to take me about 5 seconds on earlier versions.
You can install pip via apt-get: “
sudo apt-get install python-pip
“. Then you can use “pip” for installing the newest versions of Python packages. pip for python is like apt-get for Debian-like systems. pip can resolve dependencies, which is awesome. Unfortunately the Ubuntu repos are sometimes out-of-date, so if you want the newest versions, I recommend using pip.Thanks!
easier to follow than http://www.scipy.org/Installing_SciPy/Linux#head-fb320be917b02f8fbe70e3fb2c9fe6f5f5f06fc2
Above put me on the right path. Also did:
sudo apt-get install libz-dev libpng-dev libfreetype6-dev python-dev
to install matplotlib.any way to install pymat through pip
I just did:
sudo apt-get install python-scipy
That works too. But it comes from the Ubuntu repos that are often outdated. Via pip you get the newest version.
Problem with the Ubuntu repos is that it installs NumPy and SciPy for Python 2.7. If you only use Python 2, then Synaptic works just fine. However, they’ve recently become available for Python 3.x, which was great news, but it was still hard work — manually compiling both, plus their dependencies — last time I installed them.