Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: libmpi_cxx.so.40: cannot open shared object file: No such file or directory while import torch #5

Closed
adrianwojdat opened this issue Oct 4, 2020 · 1 comment

Comments

@adrianwojdat
Copy link

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/torch/__init__.py", line 135, in <module>
    _load_global_deps()
  File "/usr/local/lib/python3.7/dist-packages/torch/__init__.py", line 93, in _load_global_deps
    ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.7/ctypes/__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libmpi_cxx.so.40: cannot open shared object file: No such file or directory

To solve this problem we need to reinstall openmpi

sudo apt-get install --reinstall openmpi-bin libopenmpi-dev
@nikrtyd
Copy link

nikrtyd commented Oct 17, 2023

Quick note for Fedora/other RH-based distro users:

Sometimes this error shows up even if openmpi and openmpi-devel packages were already installed.
To fix that, you should add the path to OpenMPI libraries to LD_LIBRARY_PATH:

  1. Open the config file: sudo nano /etc/ld.so.conf.d/openmpi-x86_64.conf.
  2. Add /usr/lib64/openmpi/lib if it doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants