Today I installed numpy on a cluster. Normally, as a Gentoo admin, I just install things with emerge, and all the details are taken care of automagically. However, this cluster runs Red Hat Enterprise, and I don’t have admin privileges, so I had to install numpy in my home directory. I installed 1.0.4, to match the version used on another system. You may not need to do this for more recent versions of numpy, which may have an improved setup script. The overall process is:

Unpack the tar file with: tar xfvz numpy-1.0.4.tar.gz cd numpy-1.0.4 cp site.cfg.example site.cfg vi site.cfg python setup.py install –home=~

Numpy tries to find the installed system linear algebra libraries BLAS, ATLAS, and LAPACK. If it can’t find them, you will miss out on some dramatic speed improvements. This cluster happens to have the Intel Math Kernel Libraries (mkl), which replace the open source versions. To tell numpy where to find mkl, you have to edit the file site.cfg. It is not immediately obvious what to do–at first I tried to add the mkl path and library names to the blas_opt and lapack_opt sections, but that didn’t work. I had to add a section as follows:

[mkl]

library_dirs = /opt/software/intel/mkl/10.0.1.014/lib/em64t

mkl_libs = mkl, guide

lapack_libs = mkl_lapack

include_dirs = /opt/software/intel/mkl/10.0.1.014/include

I didn’t have to uncomment the blas_opt or lapack_opt sections at all. I got this idea from a file I found on the scipy web site.

Leave a comment if this does or does not work for you.