openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.83k stars 810 forks source link

TypeError: 'numpy.intc' object is not iterable #504

Open petport opened 4 years ago

petport commented 4 years ago

Describe the bug I'm able to use env that requires mujoco such as 'CartPole-v1', but can't render any of Fetch robotic env. This is likely something like TypeError:'numpy.int32' object is not iterable for make('FetchReach-v1') #324 . Fix fix advanced mujoco envs for windows path separation #1220 Does not work for me

To Reproduce import gym # openAi gym from gym import envs

env = gym.make('FetchSlide-v1') env.reset() for _ in range(1000): env.render() env.step(env.action_space.sample()) # take a random action env.close()

Error Messages Traceback (most recent call last): File "C:/Users/petrosp/PycharmProjects/FetchReach/FetchReach.py", line 4, in

env = gym.make('FetchSlide-v1')

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\registration.py", line 156, in make return registry.make(id, **kwargs)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\registration.py", line 101, in make env = spec.make(**kwargs)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\registration.py", line 73, in make env = cls(**_kwargs)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\fetch\slide.py", line 24, in init initial_qpos=initial_qpos, reward_type=reward_type)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\fetch_env.py", line 48, in init initial_qpos=initial_qpos)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\robot_env.py", line 36, in init self._env_setup(initial_qpos=initial_qpos)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\fetch_env.py", line 172, in _env_setup self.sim.data.set_joint_qpos(name, value)

File "mujoco_py\generated/wrappers.pxi", line 2547, in mujoco_py.cymj.PyMjData.set_joint_qpos TypeError: 'numpy.intc' object is not iterable

Desktop (please complete the following information):

shangdongyang commented 4 years ago

I also have this problem.

TneitaP commented 4 years ago

Same problem happened in:

TneitaP commented 4 years ago

@pedagil I cloned the current master of mujoco-py, changed all isinstance(addr, (int, np.int32, np.int64))|-> hasattr(addr, '__int__') in mujoco-py\mujoco_py\generated\wrappers.pxi as discussed at TypeError:'numpy.int32' object is not iterable. Finally, I used pip install -e . in the cloned mujoco-py mater repo, and successfully created the hand related repo, e.g.env = gym.make('HandManipulatePenTouchSensorsDense-v0')

hand
leey127 commented 4 years ago

I have the same problem, on Windows 10. Seems that the solutions for TypeError:'numpy.int32' object is not iterable. can not work for this issue.

Iskandor commented 4 years ago

@pedagil I cloned the current master of mujoco-py, changed all isinstance(addr, (int, np.int32, np.int64))|-> hasattr(addr, '__int__') in mujoco-py\mujoco_py\generated\wrappers.pxi as discussed at TypeError:'numpy.int32' object is not iterable. Finally, I used pip install -e . in the cloned mujoco-py mater repo, and successfully created the hand related repo, e.g.env = gym.make('HandManipulatePenTouchSensorsDense-v0')

hand

Worked for me for FetchReach-v1 environment. Thanks a lot.

KindleKin commented 4 years ago

@pedagil I cloned the current master of mujoco-py, changed all isinstance(addr, (int, np.int32, np.int64))|-> hasattr(addr, '__int__') in mujoco-py\mujoco_py\generated\wrappers.pxi as discussed at TypeError:'numpy.int32' object is not iterable. Finally, I used pip install -e . in the cloned mujoco-py mater repo, and successfully created the hand related repo, e.g.env = gym.make('HandManipulatePenTouchSensorsDense-v0')

hand

Where is your setup.py of mujoco-py ? How to pip install -e .

KindleKin commented 4 years ago

@pedagil I cloned the current master of mujoco-py, changed all isinstance(addr, (int, np.int32, np.int64))|-> hasattr(addr, '__int__') in mujoco-py\mujoco_py\generated\wrappers.pxi as discussed at TypeError:'numpy.int32' object is not iterable. Finally, I used pip install -e . in the cloned mujoco-py mater repo, and successfully created the hand related repo, e.g.env = gym.make('HandManipulatePenTouchSensorsDense-v0')

hand

Where is your setup.py of mujoco-py ? How to pip install -e .

Oh,I've got it!

paulskv commented 3 years ago

@pedagil I cloned the current master of mujoco-py, changed all isinstance(addr, (int, np.int32, np.int64))|-> hasattr(addr, '__int__') in mujoco-py\mujoco_py\generated\wrappers.pxi as discussed at TypeError:'numpy.int32' object is not iterable. Finally, I used pip install -e . in the cloned mujoco-py mater repo, and successfully created the hand related repo, e.g.env = gym.make('HandManipulatePenTouchSensorsDense-v0')

hand

I have no words. Not all heroes wear capes. Thank you.

namansaxena9 commented 2 years ago

I edited the wrappers.pxi file as mentioned and reinstalled mujoco-py. I am still facing the same issue. Please suggest.

2000222 commented 2 years ago

Describe the bug I'm able to use env that requires mujoco such as 'CartPole-v1', but can't render any of Fetch robotic env. This is likely something like TypeError:'numpy.int32' object is not iterable for make('FetchReach-v1') #324 . Fix fix advanced mujoco envs for windows path separation #1220 Does not work for me

To Reproduce import gym # openAi gym from gym import envs

env = gym.make('FetchSlide-v1') env.reset() for _ in range(1000): env.render() env.step(env.action_space.sample()) # take a random action env.close()

Error Messages Traceback (most recent call last): File "C:/Users/petrosp/PycharmProjects/FetchReach/FetchReach.py", line 4, in

env = gym.make('FetchSlide-v1')

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\registration.py", line 156, in make return registry.make(id, **kwargs)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\registration.py", line 101, in make env = spec.make(**kwargs)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\registration.py", line 73, in make env = cls(**_kwargs)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\fetch\slide.py", line 24, in init initial_qpos=initial_qpos, reward_type=reward_type)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\fetch_env.py", line 48, in init initial_qpos=initial_qpos)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\robot_env.py", line 36, in init self._env_setup(initial_qpos=initial_qpos)

File "C:\Users\petrosp\Anaconda3\envs\MainEnv\lib\site-packages\gym\envs\robotics\fetch_env.py", line 172, in _env_setup self.sim.data.set_joint_qpos(name, value)

File "mujoco_py\generated/wrappers.pxi", line 2547, in mujoco_py.cymj.PyMjData.set_joint_qpos TypeError: 'numpy.intc' object is not iterable

Desktop (please complete the following information):

  • OS: Windows 10
  • Python Version 3.7.5
  • Mujoco Version [e.g. 1.50]
  • mujoco-py version [e.g. 1.50.1.68]

Can not solve the problem even with mujoco 150, 200 or 210. If there exist any new solution ......