How to Install Numpy and Scipy on Rocks Cluster 6.1.1

I recently installed Numpy and Scipy on a cluster built with Rocks 6.1.1. The guide I used was based upon this wiki page. Python was installed under this directory: /share/apps/python . Here are the steps I took.
Python installation

wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar zxvf Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=/share/apps/python --with-readline=gnu
make -j30
make install
cd ..

Lapack installation

wget http://www.netlib.org/lapack/lapack-3.5.0.tgz
tar zxvf lapack-3.5.0.tgz
cd lapack-3.5.0
cp INSTALL/make.inc.gfortran make.inc

Edit make.inc and change OPTS and NOOPT

OPTS = -O2 -fPIC
NOOPT = -O0 -fPIC

make -j20
make blaslib lapacklib tmglib lapack_testing
cd ..

Atlas installation

wget http://sourceforge.net/projects/math-atlas/files/Stable/3.10.2/atlas3.10.2.tar.bz2
tar -jxvf atlas3.10.2.tar.bz2
cd ATLAS
mkdir ATLAS_LINUX
cd ATLAS_LINUX
../configure -Fa alg -fPIC --prefix=/share/apps/python --with-netlib-lapack-tarfile=/root/lapack-3.5.0.tgz
make
cd lib
make shared
make ptshared
cd ..
make install
cd ../..

UMFPACK UFconfig AMD installation

wget http://www.cise.ufl.edu/research/sparse/umfpack/current/UMFPACK.tar.gz
wget https://www.cise.ufl.edu/research/sparse/UFconfig/current/SuiteSparse_config.tar.gz
wget http://www.cise.ufl.edu/research/sparse/amd/current/AMD.tar.gz

mkdir sparse
tar zxvf UMFPACK.tar.gz
tar zxvf SuiteSparse_config.tar.gz
tar zxvf AMD.tar.gz
mv AMD SuiteSparse_config UMFPACK sparse
cd sparse/SuiteSparse_config

Modify this file SuiteSparse_config.mk . Note that the following listing is for the file content, not commands to input.

CF = $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -O3 -fexceptions -fPIC -m64
F77 = gfortran
F77FLAGS = $(FFLAGS) -O -m64 -fPIC
INSTALL_LIB = /share/apps/python/lib
INSTALL_INCLUDE = /share/apps/python/include
BLAS = -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -L/share/apps/python/lib -llapack -lf77blas -lcblas -latlas -lgfortran
LAPACK = -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -L/share/apps/python/lib -llapack -lf77blas -lcblas -latlas -lgfortran
METIS_PATH =
METIS =
UMFPACK_CONFIG = -DNCHOLMOD
CHOLMOD_CONFIG = -DNPARTITION

Now, it’s ready for compiling.

cd ../UMFPACK
make -j20 library
make install

cd ../AMD
make
make install

cd ..
cp SuiteSparse_config/SuiteSparse_config.h /share/apps/python/include/
cd ..

Fftw installation

wget http://www.fftw.org/fftw-3.3.4.tar.gz
tar zxvf ffw-3.3.4.tar.gz
cd ffw-3.3.4
./configure --enable-sse2 --enable-threads --with-combined-threads CFLAGS="-O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -pthread -fPIC -m64" FFLAGS="-g -O2 -fPIC -m64" CXXFLAGS="-g -O2 -fPIC -m64" --prefix=/share/apps/python
make -j20
make install
cd ..

Numpy installation

wget http://sourceforge.net/projects/numpy/files/NumPy/1.8.1/numpy-1.8.1.tar.gz
tar zxvf numpy-1.8.1.tar.gz
cd numpy-1.8.1

Create a site.cfg file. Again, the following is the file content.

[DEFAULT]
library_dirs = /share/apps/python/lib
include_dirs = /share/apps/python/include
[atlas]
atlas_libs = lapack, f77blas, cblas, atlas
[amd]
amd_libs = amd
[umfpack]
umfpack_libs = umfpack, gfortran
[fftw]
libraries = fftw3

Now, let’s build it.

/share/apps/python/bin/python setup.py build
/share/apps/python/bin/python setup.py install --prefix=/share/apps/python
cd ..

Scipy installation

wget http://sourceforge.net/projects/scipy/files/scipy/0.14.0/scipy-0.14.0.tar.gz
tar zxvf scipy-0.14.0.tar.gz
cd scipy-0.14.0
/share/apps/python/bin/python setup.py build
/share/apps/python/bin/python setup.py install --prefix=/share/apps/python
cd ..

This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.