openai / safety-starter-agents

Basic constrained RL agents used in experiments for the "Benchmarking Safe Exploration in Deep Reinforcement Learning" paper.
https://openai.com/blog/safety-gym/
MIT License
395 stars 114 forks source link

ImportError: libmpi.so.12: cannot open shared object file: No such file or directory #11

Open zsn2021 opened 2 years ago

zsn2021 commented 2 years ago

System: Ubuntu 18 04 Compiler: PyCharm There was a problem installing the dependency package mpi4py==3.0.2 Does anyone have a similar problem? How to solve it?

Novice-me commented 2 years ago

Solution:

  1. Check if any MPI library is installed (e.g. MPICH, OPENMPI), if not, you can install OPENMPI by referring to the following tutorial from Microsoft https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Linux#open-mpi
  2. After the installation is complete, you can use the following command to locate libmpi.so.12 sudo find ./ -name libmpi.so.12
  3. Usually, the problem has been solved and you can install the mpi4py library. But if you are using Anaconda or other virtual env, you also need to copy libmpi.so.12 to the lib folder of env
xuedingebuaimao commented 1 year ago

I directly used the command "conda install mpi4py", which installed the following packages.

The following NEW packages will be INSTALLED:

ipykernel anaconda/pkgs/main/linux-64::ipykernel-6.9.1-py37h06a4308_0 mpi anaconda/pkgs/main/linux-64::mpi-1.0-mpich mpi4py anaconda/pkgs/main/linux-64::mpi4py-3.1.4-py37hfc96bbd_0 mpich anaconda/pkgs/main/linux-64::mpich-3.3.2-external_0

Then I ran "from mpi4py import MPI" and got the ImportError. Initially, I found there was no "libmpi.so.12" in my conda env's lib folder, which I thought corresponds to the 3rd point you mentioned, so I copied it from pkgs/... and now have the following "libmpi.so.12"

/home/nico/anaconda3/lib/libmpi.so.12 /home/nico/anaconda3/envs/condavenv1/lib/libmpi.so.12 /home/nico/anaconda3/pkgs/mpich-3.3.2-hc856adb_0/lib/libmpi.so.12

but still get the same error.

wfc1102 commented 8 months ago

Same error here: from mpi4py import MPI ImportError: libmpi.so.12: cannot open shared object file: No such file or directory

conda install -c conda-forge mpi4py conda install mpi4py

conda uninstall mpi4py pip uninstall mpi4py

install and uninstall several times does not work. When conda uninstall it shows:

mpi-1.0-mpich mpi4py-3.1.4-py38hfc96bbd_0 mpich-3.3.2-external_0

Before give up, I tried

pip install mpi4py

Successfully installed mpi4py-3.1.5 My program runs smoothly. It seems the mpi4py version matters. conda install differs from pip install by selecting different version at this issue.