Building numpy with ATLAS/LAPACK support Building numpy with ATLAS/LAPACK support python python

Building numpy with ATLAS/LAPACK support


An orthogonal suggestion, but it may be helpful in general, not just for your particular problem.

Give a look at Spack.It is a package manager that builds packages from sources. It is a very interesting and promising project which allows you to build a vast variety of libraries/software with just a few steps.

I've just checked and py-numpy is a supported package (i.e. spack list numpy). If you want to install with default options (check them with spack info py-numpy), you can just install it with a simple spack install py-numpy and it will be built along with missig dependencies.

If you want to change something, e.g. you may want to use a particular implementation or version of BLAS/LAPACK, you can easily specify the wanted dependency (i.e. spack install py-numpy ^openblas)

I can assure you it will save you a lot of headaches, it did for me a lot of times. I use it both on the HPC I work on and on my local machines.

I've just shown you a few commands, but I just scraped the surface of what you can easily do with it (you may have multiple variant of numpy built with different BLAS implementations, or same implementation with different options, or ... in case I suggest you to start looking at "spec syntax").


BLAS/LAPACK is an optional dependency for numpy. So, depending on what you are trying to do, you might leave ATLAS out completely.

If you want to make sure that your numpy was compiled against the correct libraries, I would go outside of Python and numpy and use ldd on the compiled libraries.

I'm on latest numpy and Python 3.7, so filenames will look different for you.

> cd <numpy_dir>> find . -name "*.so"./core/_dummy.cpython-37m-darwin.so./core/_multiarray_tests.cpython-37m-darwin.so./core/_multiarray_umath.cpython-37m-darwin.so./core/_operand_flag_tests.cpython-37m-darwin.so./core/_rational_tests.cpython-37m-darwin.so./core/_struct_ufunc_tests.cpython-37m-darwin.so./core/_umath_tests.cpython-37m-darwin.so./fft/fftpack_lite.cpython-37m-darwin.so./linalg/_umath_linalg.cpython-37m-darwin.so./linalg/lapack_lite.cpython-37m-darwin.so./random/mtrand.cpython-37m-darwin.so

Then I ran ldd (I used otool -L since I'm on macOS) on each file. The following 3 files were compiled against the BLAS library.

core/_multiarray_umath.cpython-37m-darwin.solinalg/_umath_linalg.cpython-37m-darwin.solinalg/lapack_lite.cpython-37m-darwin.so


I did it with numpy 1.11.1 (which means that my answer may not be 100% accurate in your case) with the following receipe:

export ATLAS=<folder with the atlas/lapack libraries>export LAPACK=$ATLAScat > site.cfg <<EOF[atlas]atlas_libs = lapack, f77blas, cblas, atlasEOFpython setup.py bdist_wheel