akjayant / mbppol

This repository has code for the paper "Model-based Safe Deep Reinforcement Learning via a Constrained Proximal Policy Optimization Algorithm" accepted at NeurIPS 2022.
MIT License
24 stars 3 forks source link

Unable to run mbppo_lagrangian.py #2

Closed chrismartel closed 1 year ago

chrismartel commented 1 year ago

Hi @akjayant ,

I followed the installation pipeline from the README.md but I get the following conflicts when running python3.8 mbppo_lagrangian.py --exp_name="test_1" --seed=0 --env="Safexp-PointGoal2-v0" --beta=0.02:

Traceback (most recent call last): File "mbppo_lagrangian.py", line 9, in from utils.logx import EpochLogger File "/lustre03/project/6002409/cmartel/safe_rl/mbppo/mbppol/src/utils/logx.py", line 16, in from .mpi_tools import proc_id, mpi_statistics_scalar File "/lustre03/project/6002409/cmartel/safe_rl/mbppo/mbppol/src/utils/mpi_tools.py", line 1, in from mpi4py import MPI ModuleNotFoundError: No module named 'mpi4py' (mbppo) [cmartel@beluga2 src]$ module load mpi4py (mbppo) [cmartel@beluga2 src]$ vim ~/.bashrc connect 192.168.2.224 port 6000: Connection refused (mbppo) [cmartel@beluga2 src]$ source .bashrc -bash: .bashrc: No such file or directory (mbppo) [cmartel@beluga2 src]$ source ~/.bashrc (mbppo) [cmartel@beluga2 src]$ python3.8 mbppo_lagrangian.py --exp_name="test_1" --seed=0 --env="Safexp-PointGoal2-v0" --beta=0.02 2023-07-03 19:00:17.595867: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0 Creating environment: Safexp-PointGoal2-v0 Traceback (most recent call last): File "mbppo_lagrangian.py", line 795, in env = SafetyGymEnv(robot=robot, task="goal", level='2', seed=10, config=env_config) File "/lustre03/project/6002409/cmartel/safe_rl/mbppo/mbppol/src/env_utils.py", line 57, in init self.env = gym.make(env_name) File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, kwargs) File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/gym/envs/registration.py", line 72, in make cls = load(self.entry_point) File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/gym/envs/registration.py", line 17, in load mod = importlib.import_module(mod_name) File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.8.10/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 848, in exec_module File "", line 219, in _call_with_frames_removed File "/lustre03/project/6002409/cmartel/safe_rl/mbppo/safety-gym/safety_gym/envs/mujoco.py", line 9, in from safety_gym.envs.engine import * # noqa File "/lustre03/project/6002409/cmartel/safe_rl/mbppo/safety-gym/safety_gym/envs/engine.py", line 9, in import mujoco_py File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/mujoco_py/init.py", line 3, in from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/mujoco_py/builder.py", line 506, in cymj = load_cython_ext(mujoco_path) File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/mujoco_py/builder.py", line 101, in load_cython_ext mod = load_dynamic_ext('cymj', cext_so_path) File "/lustre03/project/6002409/cmartel/venv/mbppo/lib/python3.8/site-packages/mujoco_py/builder.py", line 125, in load_dynamic_ext return loader.load_module() File "mujoco_py/cymj.pyx", line 1, in init mujoco_py.cymj ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

It seems to be related to the numpy version required by the different packages. I am currently trying to run using numpy==1.21.4. Would it be possible to provide:

  1. The commit id of the mujoco-py repository or the version of the mujoco-py package used to run the script
  2. The commit if of the safety_gym repository used to run the script
rahulnarava commented 3 months ago

@chrismartel were you able to fix the issue?

I'm also facing this error. distutils.errors.CompileError: command '/home/rahul/anaconda3/envs/mbppol/bin/gcc' failed with exit code 1