ARISE-Initiative / robosuite-benchmark

Benchmarking Repository for robosuite + SAC
53 stars 15 forks source link

numpy incompatibility when running rollout visualizations #8

Open rojas70 opened 3 years ago

rojas70 commented 3 years ago

Greetings,

My rb_bench environment is setup according to documentation.

Particularly for numpy and mujoco I have the following versions:

numpy                           1.16.0
mujoco-py                       2.0.2.9

However, when I first tried to visualize a rollout in my 'rb_bench' conda environment by calling python scripts/rollout.py --load_dir runs/PickPlaceCan-Panda-OSC-POSE-SEED129/PickPlaceCan_Panda_OSC_POSE_SEED129_2020_09_21_20_07_31_0000--s-0/ --horizon 200 --camera frontview

I get the following error:

Traceback (most recent call last):
  File "scripts/rollout.py", line 1, in <module>
    from util.rlkit_utils import simulate_policy
  File "/home/juan/python/drl/toolsuites/robosuite-benchmark/util/rlkit_utils.py", line 19, in <module>
    import robosuite as suite
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/__init__.py", line 1, in <module>
    from robosuite.environments.base import make
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/__init__.py", line 1, in <module>
    from .base import REGISTERED_ENVS, MujocoEnv
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/base.py", line 2, in <module>
    from mujoco_py import MjSim, MjRenderContextOffscreen
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/__init__.py", line 3, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/builder.py", line 510, in <module>
    cymj = load_cython_ext(mujoco_path)
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/builder.py", line 101, in load_cython_ext
    mod = load_dynamic_ext('cymj', cext_so_path)
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/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 88 from C header, got 80 from PyObject

It's not the first time I see this error. It is an incompatibility between mujoco and numpy. Where mujoco 2.0.2.9 needs numpy 1.20.1 I believe.

If I upgrade to 1.20.1 by doing pip remove numpy and then pip install numpy that error is fixed but then when I try to visualize the rollout with the command:

python scripts/rollout.py --load_dir runs/Door-Panda-OSC-POSE-SEED17/Door_Panda_OSC_POSE_SEED17_2020_09_13_00_26_44_0000--s-0/ --horizon 200 --camera frontview

We get the following inconsistency:

Creating window glfw
Traceback (most recent call last):
  File "scripts/rollout.py", line 87, in <module>
    reward_shaping=True
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/base.py", line 41, in make
    return REGISTERED_ENVS[env_name](*args, **kwargs)
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/manipulation/door.py", line 184, in __init__
    camera_depths=camera_depths,
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/manipulation/manipulation_env.py", line 168, in __init__
    robot_configs=robot_configs,
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/robot_env.py", line 196, in __init__
    hard_reset=hard_reset,
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/base.py", line 147, in __init__
    self._reset_internal()
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/manipulation/door.py", line 375, in _reset_internal
    super()._reset_internal()
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/robot_env.py", line 400, in _reset_internal
    robot.reset(deterministic=self.deterministic_reset)
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/robots/single_arm.py", line 175, in reset
    super().reset(deterministic)
  File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/robots/robot.py", line 147, in reset
    self.base_ori = T.mat2quat(self.sim.data.get_body_xmat(self.robot_model.root_body).reshape((3, 3)))
TypeError: expected dtype object, got 'numpy.dtype[float32]'

If I keep numpy at 17.1 but downgrade mujoco to 2.2.0 the rollouts work, but have yet to test robosuite here... It is stated that robosuite needs mujoco 2.0.2.9.

Please advice.