Error Message "ImportError: libblas.so.3: cannot open shared object file: No such file or directory" Is Displayed When Torch Is Imported

Symptom

After torch 1.8.1 is installed in the system, a message "ImportError: libblas.so.3: cannot open shared object file: No such file or directory" is displayed when torch is imported.

Cause Analysis

The OpenBLAS dependency is not installed in the system. As a result, the library does not exist.

Solution

  1. Install the system dependency.
    yum install openblas
  2. Create a soft link (subject to the actual library version).
    1. Search for the libopenblas-r0.3.9.so file (the displayed version varies according to the actual situation).
      find / -name libopenblas*so
    2. Create a soft link.
      ln -s /usr/lib64/libopenblas-r0.3.9.so /usr/lib64/libblas.so.3
      ln -s /usr/lib64/libopenblas-r0.3.9.so /usr/lib64/liblapack.so.3