Why can't I import torch?OSError: libmpi_cxx.so.40

(yolox) risk@risk-nx:~$ python
Python 3.8.13 (default, Mar 28 2022, 10:59:05)
[GCC 10.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import torch
Traceback (most recent call last):
File “”, line 1, in
File “/home/risk/miniconda3/envs/yolox/lib/python3.8/site-packages/torch/init.py”, line 198, in
File “/home/risk/miniconda3/envs/yolox/lib/python3.8/site-packages/torch/init.py”, line 151, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File “/home/risk/miniconda3/envs/yolox/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 you share more information about your setting?
Are you using JetPack 5.0DP? How do you install the PyTorch package?


Hi, I’m getting the same issue on jetpack 4.6. I’m not using any containers and installed pytorch directly from wheel. https://developer.download.nvidia.com/compute/redist/jp/v50/pytorch/torch-1.12.0a0+2c916ef.nv22.3-cp38-cp38-linux_aarch64.whl

Hi @user164564, that PyTorch 1.12 wheel is only for JetPack 5.0. The last version of PyTorch to support JetPack 4.x is PyTorch 1.10:

  • JetPack 4.4 (L4T R32.4.3) / JetPack 4.4.1 (L4T R32.4.4) / JetPack 4.5 (L4T R32.5.0) / JetPack 4.5.1 (L4T R32.5.1) / JetPack 4.6 (L4T R32.6.1)
1 Like

That was helpful thank you.