How to use numpy with OpenBLAS instead of Atlas in Ubuntu? How to use numpy with OpenBLAS instead of Atlas in Ubuntu? numpy numpy

How to use numpy with OpenBLAS instead of Atlas in Ubuntu?


Run sudo update-alternatives --all and set liblapack.so.3gf to /usr/lib/lapack/liblapack.so.3gf


To add to the accepted answer (of using update-alternatives), the reason for this is because OpenBlas is not compatible with the Atlas version of Lapack. For each of the Blas and Lapack versions:

  1. Default Blas + Default Lapack => OK
  2. OpenBlas + Default Lapack => OK
  3. Atlas-Blas + Default Lapack => OK
  4. Atlas-Blas + Atlas-Lapack => OK
  5. OpenBlas + Atlas-Lapack => ERROR! (The following case here.)

This is from both personal experience (with the exact same issue) and realizing why such a combination wasn't mentioned in this comparison blog.

By the way, you can just find the necessary files in /etc/alternatives/, usually with a filename starting with lib*. For each one do sudo update-alternatives --config <filename>. For example, do to following:

  • sudo update-alternatives --config libblas.so
  • sudo update-alternatives --config libblas.so.3

to change the Blas version.


Consider using EasyBuild (http://hpcugent.github.io/easybuild/), an open-source framework for building and installing software.

It allows you to (very easily) build and install (scientific) software with various compiler, and using different BLAS libraries (ATLAS, OpenBLAS, ACML, Intel MKL, ...).

Once you install EasyBuild (pro tip: use the bootstrapping procedure described at https://github.com/hpcugent/easybuild/wiki/Bootstrapping-EasyBuild), it boils down to running a single command, something like:

eb numpy-1.6.2-goolf-1.4.10-Python-2.7.3.eb -ldr

This will first build and install of full compiler toolchain (goolf: GCC+OpenBLAS+OpenMPI+LAPACK+FFTW), and subsequently build Python and numpy with that toolchain. And all that while you're getting lunch. ;-)

Disclaimer: I'm one of the EasyBuild developers.