Libopenblas.so.0 not found

from torch._C import * # noqa: F403
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

This is the error I encountered while running the pytorch in Jetson ORIN Nano.
Can you please suggest a fix for it?

I have tried installing libopenblas package as suggested in one of the forums, but the error still exists.

moving this topic to Jetson Orin Nano forum

Hi @amjoejoshi0098, what does ldd /usr/local/lib/python3.8/dist-packages/torch/_C.cpython-38-aarch64-linux-gnu.so show for you?

ldd /usr/local/lib/python3.8/dist-packages/torch/_C.cpython-38-aarch64-linux-gnu.so
        linux-vdso.so.1 (0x0000ffff842c1000)
        libtorch_python.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libtorch_python.so (0x0000ffff836fc000)
        libshm.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libshm.so (0x0000ffff836e4000)
        libtorch.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libtorch.so (0x0000ffff836d2000)
        libnvToolsExt.so.1 => /usr/local/cuda-11.4/lib64/libnvToolsExt.so.1 (0x0000ffff836b6000)
        libtorch_cpu.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libtorch_cpu.so (0x0000ffff7ef64000)
        libtorch_cuda.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libtorch_cuda.so (0x0000ffff6fb64000)
        libc10_cuda.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libc10_cuda.so (0x0000ffff6fb05000)
        libcudart.so.11.0 => /usr/local/cuda-11.4/lib64/libcudart.so.11.0 (0x0000ffff6fa49000)
        libcudnn.so.8 => /lib/aarch64-linux-gnu/libcudnn.so.8 (0x0000ffff6f9ee000)
        libc10.so => /usr/local/lib/python3.8/dist-packages/torch/lib/libc10.so (0x0000ffff6f977000)
        libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffff6f792000)
        libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff6f76e000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff6f73d000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff6f5ca000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffff84291000)
        librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000ffff6f5b2000)
        libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffff6f59e000)
        libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff6f4f3000)
        libgomp.so.1 => /lib/aarch64-linux-gnu/libgomp.so.1 (0x0000ffff6f4a5000)
        libnuma.so.1 => /lib/aarch64-linux-gnu/libnuma.so.1 (0x0000ffff6f486000)
        libopenblas.so.0 => /lib/aarch64-linux-gnu/libopenblas.so.0 (0x0000ffff6e5ee000)
        libcusparse.so.11 => /usr/local/cuda-11.4/lib64/libcusparse.so.11 (0x0000ffff60947000)
        libcurand.so.10 => /usr/local/cuda-11.4/lib64/libcurand.so.10 (0x0000ffff5b89d000)
        libcusolver.so.11 => /usr/local/cuda-11.4/lib64/libcusolver.so.11 (0x0000ffff4e73f000)
        libcufft.so.10 => /usr/local/cuda-11.4/lib64/libcufft.so.10 (0x0000ffff437d7000)
        libcublas.so.11 => /usr/local/cuda-11.4/lib64/libcublas.so.11 (0x0000ffff396fe000)
        libgfortran.so.5 => /lib/aarch64-linux-gnu/libgfortran.so.5 (0x0000ffff39583000)
        libcublasLt.so.11 => /usr/local/cuda-11.4/lib64/libcublasLt.so.11 (0x0000ffff21fe2000)

And what does the following show for you?

$ ls -ll /lib/aarch64-linux-gnu/libopenblas*

lrwxrwxrwx 1 root root 49 Mar  2 09:07 /lib/aarch64-linux-gnu/libopenblas.a -> /etc/alternatives/libopenblas.a-aarch64-linux-gnu
lrwxrwxrwx 1 root root 50 Mar  2 09:07 /lib/aarch64-linux-gnu/libopenblas.so -> /etc/alternatives/libopenblas.so-aarch64-linux-gnu
lrwxrwxrwx 1 root root 52 Mar  2 09:07 /lib/aarch64-linux-gnu/libopenblas.so.0 -> /etc/alternatives/libopenblas.so.0-aarch64-linux-gnu

$ ls -ll /etc/alternatives/libopenblas*

lrwxrwxrwx 1 root root 57 Mar  2 09:07 /etc/alternatives/libopenblas.a-aarch64-linux-gnu -> /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblas.a
lrwxrwxrwx 1 root root 60 Mar  2 09:07 /etc/alternatives/libopenblas.so.0-aarch64-linux-gnu -> /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblas.so.0
lrwxrwxrwx 1 root root 58 Mar  2 09:07 /etc/alternatives/libopenblas.so-aarch64-linux-gnu -> /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblas.so

$ ls -ll /usr/lib/aarch64-linux-gnu/openblas-pthread/

total 65028
drwxr-xr-x 3 root root     4096 Mar  2 09:07 cmake
lrwxrwxrwx 1 root root       13 Jun  2  2020 libblas.a -> libopenblas.a
lrwxrwxrwx 1 root root       12 Jun  2  2020 libblas.so -> libblas.so.3
-rw-r--r-- 1 root root  9244080 Jun  2  2020 libblas.so.3
lrwxrwxrwx 1 root root       13 Jun  2  2020 liblapack.a -> libopenblas.a
lrwxrwxrwx 1 root root       14 Jun  2  2020 liblapack.so -> liblapack.so.3
-rw-r--r-- 1 root root 14496456 Jun  2  2020 liblapack.so.3
lrwxrwxrwx 1 root root       21 Jun  2  2020 libopenblas.a -> libopenblasp-r0.3.8.a
-rw-r--r-- 1 root root 27617180 Jun  2  2020 libopenblasp-r0.3.8.a
-rw-r--r-- 1 root root 15213840 Jun  2  2020 libopenblasp-r0.3.8.so
lrwxrwxrwx 1 root root       22 Jun  2  2020 libopenblas.so -> libopenblasp-r0.3.8.so
lrwxrwxrwx 1 root root       22 Jun  2  2020 libopenblas.so.0 -> libopenblasp-r0.3.8.so
drwxr-xr-x 2 root root     4096 Mar  2 09:07 pkgconfig

Also, what version of JetPack-L4T are you running? You can check this with cat /etc/nv_tegra/release

BTW, if it’s faster for you, you can try running the l4t-pytorch container which should have everything already pre-installed inside it.

Thank you for your timely reply @dusty_nv.
Here are some screen shots attached below:
1
2
3
4
I am running Jetpack5.1

It’s saying it can find any of the files. What does pip3 show torch list as the install location for PyTorch? Track it down, run the ldd command that I did on it’s torch/_C.cpython-38-aarch64-linux-gnu.so file, and that will tell you which dependencies are missing.

Or if you are unfamiliar with doing these kind of things yourself, you can try the l4t-pytorch container that I linked to above.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.