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?

  • Please do not cross post.
    – Karlson
    Oct 23, 2012 at 18:11
  • Ok, removed now.
    – lmsasu
    Oct 23, 2012 at 18:28

2 Answers 2


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.

  • I am not sure whether the atlas-lib.conf was of help, but the LD_LIBRARY_PATH made the trick.
    – lmsasu
    Oct 23, 2012 at 18:36
  • 1
    @lmsasu When you create that file you will need to run sudo ldconfig to make it active
    – Karlson
    Oct 23, 2012 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, 2015 at 9:42
  • 1
    @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, 2015 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, 2015 at 2:16

For me, using a virtualenv, export LD_LIBRARY_PATH=/usr/lib/atlas-base/:${LD_LIBRARY_PATH} at the end of my .bashrc file fixed it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .