ARISE-Initiative / robosuite-benchmark

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

TypeError related to dtype when running scripts/train.py #7

Closed gr8joo closed 3 years ago

gr8joo commented 3 years ago

Hi, I had a problem when running the training code with the following command: python scripts/train.py

Then, the error I encounter is:

Traceback (most recent call last): File "scripts/train.py", line 131, in run_experiment() File "scripts/train.py", line 104, in run_experiment experiment(variant, agent=args.agent) File "/home/hjhwang/robosuite-benchmark/util/rlkit_utils.py", line 55, in experiment controller_configs=controller_config, File "/home/hjhwang/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/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/manipulation/lift.py", line 190, in init camera_depths=camera_depths, File "/home/hjhwang/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/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/robot_env.py", line 196, in init hard_reset=hard_reset, File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/base.py", line 147, in init self._reset_internal() File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/manipulation/lift.py", line 369, in _reset_internal super()._reset_internal() File "/home/hjhwang/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/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/robots/single_arm.py", line 175, in reset super().reset(deterministic) File "/home/hjhwang/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]'**

Following all the instructions, I normally installed all the packages including rlkit, except numpy. I had to upgrade numpy (from 1.17.2 to 1.20.1) since I face the following error otherwise:

Traceback (most recent call last): File "scripts/train.py", line 10, in from util.rlkit_utils import experiment File "/home/hjhwang/robosuite-benchmark/util/rlkit_utils.py", line 19, in import robosuite as suite File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/init.py", line 1, in from robosuite.environments.base import make File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/init.py", line 1, in from .base import REGISTERED_ENVS, MujocoEnv File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/robosuite/environments/base.py", line 2, in from mujoco_py import MjSim, MjRenderContextOffscreen File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/init.py", line 3, in from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException File "/home/hjhwang/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/builder.py", line 510, in cymj = load_cython_ext(mujoco_path) File "/home/hjhwang/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/hjhwang/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

I tried to fix it by myself searching info related to the error message, but did not work so far. Does anyone have a similar issue or know how to fix it?

Thank you!

abhihjoshi commented 3 years ago

I had run into a similar problem. The solution was mentioned in this GitHub issue post: https://github.com/ARISE-Initiative/robosuite/issues/193

gr8joo commented 3 years ago

@awesome-aj0123 Hi, thank you for your direct solution!

Seems like I need to checkout the issue page of the suite as well.

Thank you!

samarth-robo commented 3 years ago

For anyone not able to update numpy to 1.20 because of tensorflow, you can build the mujoco-py wheel locally after installing numpy 1.19.2:

pip install mujoco-py==2.0.2.9 --no-cache-dir --no-binary :all: --no-build-isolation

with help from https://github.com/scikit-learn-contrib/hdbscan/issues/457#issuecomment-774033215