Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Ubuntu 12.04 64 bit. I need to work with python and scipy, I installed them and when I run the test:

python -c "import scipy; scipy.test()"

I get the message:

ImportError: libatlas.so.3gf: cannot open shared object file: No such file or directory

However, I have libatlas libraries installed under the directory /usr/lib/atlas-base. I know I can copy the files directly under /usr/lib, but I wonder how I could setup the scipy to use the libraries from usr/lib/atlas-base?

share|improve this question
Please do not cross post. – Karlson Oct 23 '12 at 18:11
Ok, removed now. – lmsasu Oct 23 '12 at 18:28
up vote 18 down vote accepted

You don't have to copy anything anywhere.

You should add the atlas libraries to the list of locations ld will search.

In directory /etc/ld.so.conf.d you can add the file atlas-lib.conf. This file should contain the directory of libatlas.so.3gf, which is /usr/lib/atlas-base.

You can do this by running

echo "/usr/lib/atlas-base" | sudo tee /etc/ld.so.conf.d/atlas-lib.conf

Finally run

sudo ldconfig

to update ld so that it knows about this new file.

Alternatively you can set LD_LIBRARY_PATH to include the path to the library when you run and it should be available within SciPy.

share|improve this answer
I am not sure whether the atlas-lib.conf was of help, but the LD_LIBRARY_PATH made the trick. – lmsasu Oct 23 '12 at 18:36
@lmsasu When you create that file you will need to run sudo ldconfig to make it active – Karlson Oct 23 '12 at 18:40
If you don't have root access, what would be the best approach? If you would do it with virtualenv, how would you do in that case? – Albert Jan 15 '15 at 9:42
@Albert Using virtualenv is a completely separate subject but without root access you can set LD_LIBRARY_PATH in an appropriate manner which is mentioned in the answer. – Karlson Jan 15 '15 at 15:03
This sort of thing should be handled by either numpy/scipy or libatlas-dev packages, no? I have an interesting situation where system numpy 1.9.1 works fine, but numpy 1.9.2 in a virtualenv exhibits this problem. Anyway, your solution fixed it. thx. – drevicko Apr 19 '15 at 2:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.