How to make sure the numpy BLAS libraries are available as dynamically-loadable libraries?

Framester picture Framester · Jul 22, 2011 · Viewed 25.5k times · Source

The theano installation documentation states, that theano will as a default use the BLAS libraries from numpy, if the "BLAS libraries are available as dynamically-loadable libraries". This seems not to be working on my machine, see error message.

  • How do I find out, if the numpy BLAS libraries are availalbe as dynamically-loadable?
  • How do I recompile the numpy BLAS libraries, if they are not dynamically-loadable?

Please indicate, if you would need more information!

Error message

We did not found a dynamic library into the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library. /usr/bin/ld: cannot find -lblas

Appendix

The theano library needs among other things numpy and a BLAS library. I figured numpy comes with BLAS if you install it with sudo apt-get install python-numpy python-scipy under Ubuntu.

This is the filelisting of /usr/lib64/python2.6/dist-packages/scipy/lib/blas

cblas.so  info.py   __init__.py   scons_support.py   setup.py     
fblas.so  info.pyc  __init__.pyc  scons_support.pyc  setup.pyc  
setupscons.py  test
setupscons.pyc

This is the output of distutils.__config__.show() is as follows

blas_info:
    libraries = ['blas']
    library_dirs = ['/usr/lib64']
    language = f77

lapack_info:
    libraries = ['lapack']
    library_dirs = ['/usr/lib64']
    language = f77

atlas_threads_info:
  NOT AVAILABLE

blas_opt_info:
    libraries = ['blas']
    library_dirs = ['/usr/lib64']
    language = f77
    define_macros = [('NO_ATLAS_INFO', 1)]

atlas_blas_threads_info:
  NOT AVAILABLE

lapack_opt_info:
    libraries = ['lapack', 'blas']
    library_dirs = ['/usr/lib64']
    language = f77
    define_macros = [('NO_ATLAS_INFO', 1)]

atlas_info:
  NOT AVAILABLE

lapack_mkl_info:
  NOT AVAILABLE

blas_mkl_info:
  NOT AVAILABLE

atlas_blas_info:
  NOT AVAILABLE

mkl_info:
  NOT AVAILABLE

Answer

stewart picture stewart · Nov 7, 2013

After downloading the Anaconda distro of python libraries, I just encountered the same issue on Ubuntu 12.04 LTS 64-bit. Pointing Theano to the directory containing libblas.so took care of it.

$ THEANO_FLAGS=blas.ldflags="-L/usr/lib/ -lblas" python rbm.py