OSError: libmpi_cxx.so.40: cannot open shared object file: No such file or directory

Hi,I’m using jetpack5.0, cuda10.2, torch1.11 and python3.8.I download torch from here: PyTorch for Jetson - Jetson & Embedded Systems / Announcements - NVIDIA Developer Forums
But when I try to import torch, it report error:

Traceback (most recent call last):
File “/home/nvidia/catkin_ws/src/ab3d/src/modelROS.py”, line 15, in
import torch
File “/home/nvidia/anaconda3/envs/AB3D/lib/python3.8/site-packages/torch/init.py”, line 198, in
_load_global_deps()
File “/home/nvidia/anaconda3/envs/AB3D/lib/python3.8/site-packages/torch/init.py”, line 151, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File “/home/nvidia/anaconda3/envs/AB3D/lib/python3.8/ctypes/init.py”, line 373, in init
self._handle = _dlopen(self._name, mode)
OSError: libmpi_cxx.so.40: cannot open shared object file: No such file or directory

Could please help me?

Hi @3356383019, if you haven’t already, can you try running this to install OpenMPI?

sudo apt-get install libopenblas-base libopenmpi-dev libomp-dev

If you still get the same error after that, what does the command below show for you?

$ find /usr/lib -name 'libmpi_cxx*'

/usr/lib/aarch64-linux-gnu/libmpi_cxx.so.40
/usr/lib/aarch64-linux-gnu/openmpi/lib/libmpi_cxx.so.40.20.1
/usr/lib/aarch64-linux-gnu/openmpi/lib/libmpi_cxx.so
/usr/lib/aarch64-linux-gnu/libmpi_cxx.so.40.20.1
/usr/lib/aarch64-linux-gnu/libmpi_cxx.so

Firstly, thank you for your reply.
However, I have installed openmpi previously, but I still get this error, because apt in ubuntu18.04 can only get openmpi=2.1, which doesn’t have libmpi_cxx_so.40.
If I input the command, it show:

$ find /usr/lib -name ‘libmpi_cxx*’

/usr/lib/aarch64-linux-gnu/libmpi_cxx.so.20.10.0
/usr/lib/aarch64-linux-gnu/openmpi/lib/libmpi_cxx.so.20.10.0
/usr/lib/aarch64-linux-gnu/openmpi/lib/libmpi_cxx.so
/usr/lib/aarch64-linux-gnu/libmpi_cxx.so
/usr/lib/aarch64-linux-gnu/libmpi_cxx.so.20

How can I get openmpi>=3.0? Or do you have other method?
Thank you!

Hi @3356383019, your original post above said you were on JetPack 5 - which is based on Ubuntu 20.04, and would have installed libmpi_cxx.so.40. If you are in fact on JetPack 4 and Ubuntu 18.04, then you should install one of the PyTorch wheels built for JetPack 4 instead.

I manually upgrade jetpack to 5.0, because my virtual environment is based on python 3.8, but all the Pytorch wheels built for jetpack4 use python3.6. Can I use these wheel on python3.8? Or do you have Pytorch wheels built for jetpack4 use python3.8?

It’s the later - you would need to rebuilt PyTorch for JetPack 4 and Python 3.8. This is because the versions of CUDA in JetPack 4 (CUDA 10.2) are different than JetPack 5 (CUDA 11.4).

There are Build from Source instructions under PyTorch for Jetson. Or since you are on Xavier, you could just reflash your device with JetPack 5 and use Ubuntu 20.04 / Python 3.8 straight away (which is what I’d probably recommend, baring other factors that you might have)

1 Like

I rebuild jetpack to 4.6.1, establiash a new virtual environment based on python3.6, and this time it works.
Thank you!

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