# Install Numpy and Scipy on CentOS without Root Privilege 4

Sometimes you want to install Numpy and Scipy on a remote CentOS machine without root privilege, which is usually true when you are using a university server. Before you proceed to the following instructions, you need to make sure that a copy of Python is installed. This is also done without root privilege, meaning that you may install it in an alternative directory, rather than system directory.

### Prerequisite:

1. Download the latest version of LAPACK and extracted it into path [LAPACK].
2. Download the latest version of BLAS and extracted it into path [BLAS].

Note that in almost all tutorials on how to install Numpy and Scipy on Linux machines discuss how to install them with ATALS. This is possible only if you have the root privilege where you can turn off CPU threshoding . Since we do not have root privilege, we can only install them with LAPACK and BLAS.

### Step 1: Install Numpy

1. Edit “site.cfg”
a) Enable “[DEFAULT]” section and add

src_dirs = [BLAS]:[LAPACK]

b) Add

[blas_opt] libraries = f77blas, cblas   [lapack_opt] libraries = lapack, f77blas, cblas
2. Type the following command in the shell:
python setup.py build --fcompiler=gnu95

which will compile the package with “gfortran”.

3. Type the following command in the shell:
python setup.py install

### Step 2: Install Scipy

Once Numpy is installed.  Scipy can be easily built and installed through normal “python setup.py build” and “python setup.py install” process. Remember that these command should be accompanied with “–fcompiler=gnu95”.

## 4 thoughts on “Install Numpy and Scipy on CentOS without Root Privilege”

• Vaibhav

Hello, thank you for providing alternative method. I ppended my numpy path to PYTHONPATH but I get the error

Traceback (most recent call last):
File “”, line 1, in
File “/home/vaibhav/Downloads/numpy-1.6.2/numpy/__init__.py”, line 127, in
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.

can you please suggest whats going wrong ?

regards,
Vaibhac

• Liangjie Hong Post author

Although I’m not sure exactly what’s going on to your problem, it looks that you’re importing the library from where you build the source.

You need to import it from anywhere else.

• Ruihao

Hi Liangjie,
Thank you for your great tutorial! I have successfully installed numpy on my own \$PYTHONPATH. However, when I proceeded to install scipy, with
“python setup.py build –fcompiler=gnu95”,
it failed with
“numpy.distutils.system_info.NotFoundError: no lapack/blas resources found”

BTW, I am using a university server just as you mentioned. LOL.

Cheers,
Ruihao

• Arrchana

Thanks for the article. I tried following the steps you have given here. However, when I run the build command in step 2, I get “RuntimeError: Running cythonize failed!”. Do let me know how I can install cython as well without root privilege.