R Package installation fails with “libopenblas.so.3: cannot open shared object file”

R
bash
Installation
Author

Johannes Titz

Published

March 8, 2023

Recently, I had trouble updating some R packages that require openblas. The error R gives is*: “libopenblas.so.3: cannot open shared object file: No such file or directory”. It seems some other people experience the same problem. With a symlink we can fix the problem quickly.

First, we check if any libopenblas.so is on our filesystem:1

locate libopenblas.so
/usr/lib/libopenblas.so
/usr/lib/libopenblas.so.0
/usr/lib/libopenblas.so.0.3
/usr/lib/libopenblas.so.3

Sometimes there is no file with the correct version (libopenblas.so.3), but with a different version (e.g. libopenblas.so.0.3). If this happens, simply make a symlink from one version to the other (0.3 to 3):

sudo ln -s /usr/lib/libopenblas.so.0.3 /usr/lib/libopenblas.so.3

That is it, now package installation should work again.

Footnotes

  1. If you do not have locate, install it first.↩︎