2

I'm trying to install Theano on a box for which I have no root access and it looks like that LD_LIBRARY_PATH is ignored by my installation of Python 2.7. Since I can't install packages at the system level, I decided to compile all the packages (Python, SciPy, OpenBLAS, and others) from source and install them to $HOME. While testing SciPy, I got the error ERROR: Failure: ImportError (libopenblas.so.0: cannot open shared object file: No such file or directory) but it looks like the library is present and LD_LIBRARY_PATH points to the correct folder. Here's the complete transcript:

wheatstone-acogliat 42% echo $LD_LIBRARY_PATH
/home/seas/grad/acogliat/lib

wheatstone-acogliat 43% python -c "import scipy; scipy.test()"
Running unit tests for scipy
NumPy version 1.9.3
NumPy is installed in /home/seas/grad/acogliat/lib/python2.7/site-packages/numpy
SciPy version 0.16.0
SciPy is installed in /home/seas/grad/acogliat/lib/python2.7/site-packages/scipy
Python version 2.7.10 (default, Sep 28 2015, 21:06:05) [GCC 4.1.2 20080704 (Red Hat 4.1.2-55)]
nose version 1.3.7
/home/seas/grad/acogliat/lib/python2.7/site-packages/numpy/lib/utils.py:95: DeprecationWarning: `scipy.weave` is deprecated, use `weave` instead!
  warnings.warn(depdoc, DeprecationWarning)
E.......................................................................K.......................................................................................................EEEEEEEEE.....................................................................................................EE......................................................................S...........EEE...........................................K......................................................................................................
======================================================================
ERROR: Failure: ImportError (libopenblas.so.0: cannot open shared object file: No such file or directory)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/seas/grad/acogliat/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/seas/grad/acogliat/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/seas/grad/acogliat/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/seas/grad/acogliat/lib/python2.7/site-packages/scipy/cluster/__init__.py", line 27, in <module>
    from . import vq, hierarchy
  File "/home/seas/grad/acogliat/lib/python2.7/site-packages/scipy/cluster/vq.py", line 89, in <module>
    from . import _vq
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

[...MULTIPLE SIMILAR ERRORS OMITTED...]

FAILED (KNOWNFAIL=2, SKIP=1, errors=15)

wheatstone-acogliat 44% ls -al $LD_LIBRARY_PATH
total 47232
drwxr-sr-x  6 acogliat eestudent      512 Sep 28 22:58 ./
drwxr-sr-x 19 acogliat eestudent      512 Sep 28 23:29 ../
drwxr-sr-x  3 acogliat eestudent      512 Sep 28 22:58 cmake/
lrwxrwxrwx  1 acogliat eestudent       30 Sep 28 22:58 libopenblas.a -> libopenblas_opteronp-r0.2.14.a
-rw-r--r--  1 acogliat eestudent 25211324 Sep 28 22:57 libopenblas_opteronp-r0.2.14.a
-rwxr-xr-x  1 acogliat eestudent 12826920 Sep 28 22:57 libopenblas_opteronp-r0.2.14.so*
lrwxrwxrwx  1 acogliat eestudent       31 Sep 28 22:58 libopenblas.so -> libopenblas_opteronp-r0.2.14.so*
lrwxrwxrwx  1 acogliat eestudent       31 Sep 28 22:58 libopenblas.so.0 -> libopenblas_opteronp-r0.2.14.so*
-r-xr-xr-x  1 acogliat eestudent 10193546 Sep 28 21:36 libpython2.7.a*
drwxr-sr-x  3 acogliat eestudent      512 Sep 28 22:46 perl5/
drwxr-sr-x  2 acogliat eestudent      512 Sep 28 21:36 pkgconfig/
drwxr-sr-x 28 acogliat eestudent    14336 Sep 28 21:36 python2.7/

wheatstone-acogliat 45% uname -a
Linux wheatstone 2.6.18-404.el5 #1 SMP Tue Apr 7 12:42:54 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

What am I missing?

  • @meuh that was it! My shell was set to csh, which I'm not very familiar with. Thanks so much! If you post this as an answer, I'll accept it. – Wolfy Sep 30 '15 at 2:41
  • ah, csh! very different to the bourne shell. I updated my answer. – meuh Sep 30 '15 at 10:42
1

If the code is explicitly calling dlopen() to find files it will use LD_LIBRARY_PATH, though normal python uses $PYTHONPATH to find modules and libraries. You can also set the sys.path array:

import sys
sys.path.append('/mydir')

Remember to export the LD_LIBRARY_PATH or PYTHONPATH.

  • Thanks. I tried both $PYTHONPATH and sys.path with the same error. It looks like the only way to fix the problem is to issue an ldconfig, which I can't do because I have no root access. – Wolfy Sep 29 '15 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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