ATLAS on a python virtualenv in Fedora for numpy/scipy/scikit-learn
<p>I am struggeling to let python find and use the installed ATLAS libraries from my distribution when using virtualenv.</p>

<p>This is on Fedora 21, atlas, atlas-devel, blas, blas-devel are installed. Outside of a virtualenv, the command <code>python -c 'import numpy; numpy.show_config()'</code> shows that I have ATLAS:</p>

<pre><code>atlas_3_10_blas_threads_info:
    libraries = ['tatlas']
    library_dirs = ['/usr/lib64/atlas']
    define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = c
    include_dirs = ['/usr/include']
lapack_opt_info:
    libraries = ['tatlas', 'tatlas', 'tatlas']
    library_dirs = ['/usr/lib64/atlas']
    define_macros = [('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = f77
    include_dirs = ['/usr/include']
blas_opt_info:
    libraries = ['tatlas']
    library_dirs = ['/usr/lib64/atlas']
    define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = c
    include_dirs = ['/usr/include']
openblas_info:
NOT AVAILABLE
openblas_lapack_info:
NOT AVAILABLE
[...]
</code></pre>

<p>And <code>ls /usr/lib64/atlas/</code> gives:</p>

<pre><code>libatlas.a   libsatlas.so    libsatlas.so.3.10  libtatlas.so.3
libcblas.so  libsatlas.so.3  libtatlas.so       libtatlas.so.3.10
</code></pre>

<p>I also setup an environment variable, so that <code>echo $ATLAS</code> gives</p>

<pre><code>/usr/lib64/atlas/libsatlas.so
</code></pre>

<p>But when I do the following:</p>

<pre><code>virtualenv venv
source venv/bin/activate
pip install --upgrade pip
pip install numpy
pip install scipy
pip install scikit-learn
python -c 'import numpy; numpy.show_config()'
</code></pre>

<p>I get:</p>

<pre><code>lapack_opt_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_opt_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_lapack_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/usr/local/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_mkl_info:
NOT AVAILABLE
</code></pre>

<p>I would really appreciate help with how to get numpy and scipy simply find and use ATLAS from my distribution in a virtualenv.</p>

<p>You need to tell numpy's setup.py where to find your ATLAS libraries.</p>

<p>Try creating a <code>.numpy-site.cfg</code> file in your home folder before running <code>pip install</code>. <a href="https://github.com/numpy/numpy/blob/master/site.cfg.example" rel="nofollow">Here's</a> the template for this file. </p>

<p>You probably need to add the lines</p>

<pre><code>[atlas]
library_dirs = /usr/lib64/atlas
include_dirs = /usr/include
</code></pre>

<p>Although, this has required a little bit of trial-and-error in my experience.</p>

<p>Using this file in conjunction with <code>pip install</code> seems to work reliably on RHEL and Ubuntu, at least within virtual environments where you don't need <code>sudo</code>.</p>

<p>If this fails for one or more of numpy, scipy and scikit-learn, consider installing from source instead, and modify the site.cfg file inside the source dir before running <code>python setup.py install</code>.</p>

python numpy virtualenv blas atlas