'Scipy installation issue, getting ImportError: libopenblas.so.0: cannot open shared object file or directory

I am installing Scipy-0.16.1 on Ubuntu 14.04

OpenBLAS_0.2.18 and Numpy-1.11.0 have been installed with no issues.

Scipy-0.16.1.tar.gz has been downloaded

site.cfg was copied and un-commented the following lines:

[openblas]

libraries = openblas

library_dirs = /opt/OpenBLAS/lib

include_dirs = /opt/OpenBLAS/include

Added a line to ~/.bashrc

export LD_LIBRARY_PATH=/opt/OpenBLAS/lib:$LD_LIBRARY_PATH

source ~/.bashrc

ldconfig

sudo python setup.py config

ERROR

ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory



Solution 1:[1]

You have to install OpenBlas system library. Try:

sudo apt-get install libopenblas-dev

Solution 2:[2]

Firstly, try locate libopenblas.so.0 to find out the path.

Then, do echo $LD_LIBRARY_PATH to check if it has been included.

Solution 3:[3]

In my case, I am using Ubuntu 20.04 and I have scipy on 1.2.1. This causes the error above.

The reason is scipy 1.2.1 looks for libopenblas.so.0. But, Ubuntu 20.04 APT repo libraries will only support libopenblas.so.

So, my solution was to upgrade scipy to 1.4.0 or above.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Francesco Nazzaro
Solution 2 qun
Solution 3 Yao Hong Kok