0

I built numpy locally from source with python 2.7.2 because I dont have root access to the system. After installation, I appended the following path /path/to/install/lib/python2.7/site-packages to PYTHONPATH. When I tried to import from python, I get following error:

import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/path/to/numpy/numpy-1.8.0/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module> from . import add_newdocs File "/path/to/numpy/numpy-1.8.0/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/path/to/numpy/numpy-1.8.0/lib/python2.7/site-packages/numpy/lib/__init__.py", line 18, in <module> from .polynomial import * File "/path/to/numpy/numpy-1.8.0/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 19, in <module> from numpy.linalg import eigvals, lstsq, inv File "/path/to/numpy/numpy-1.8.0/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 50, in <module> from .linalg import * File "/path/to/numpy/numpy-1.8.0/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 29, in <module> from numpy.linalg import lapack_lite, _umath_linalg ImportError: libgfortran.so.1: cannot open shared object file: No such file or directory 

I also made GCC locally and have all the paths and library paths set correctly. While building numpy, I didn't build ATLAS because the machine I am running on has cpu throttling on and I cannot change it. Without turning throttling off, ATLAS cannot be installed.

What could be the possible reasons for this error ?

3
  • What's your question? Commented Feb 4, 2014 at 3:55
  • Is the path to numpy part of your PYTHONPATH? Commented Feb 4, 2014 at 3:56
  • No. /path/to/numpy is just an example for location to numpy. PYTHONPATH has actual path. I cant write the actual path so I added /path/to/numpy. Sorry about that. Commented Feb 4, 2014 at 3:59

1 Answer 1

1

This looks like a dependancy issue with the fortran libraries on your machine.

In general, local installation of any package can be achieved in three (easy) ways that I know of, none of which require changing the python path.

  1. virtualenv
  2. conda
  3. pip

The easiest of these is using pip with the --user flag.

pip install numpy --user 

Make sure ~/.local/bin is in the $PATH, then if your dependancies are correct, numpy should just work.

Sign up to request clarification or add additional context in comments.

2 Comments

I know about these ways. Its just pip, conda and virtualenv are not installed on the machine. I also don't have root permissions as the machine I intend to build is a university managed cluster. That is the reason I am building numpy from source.
pip can be installed for the local user (without root permissions) by using the get-pip.py script with --user

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.