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.81k stars 810 forks source link

if self.viewer is not None: AttributeError: 'env' object has no attribute 'viewer' #739

Open pramodiisc opened 1 year ago

pramodiisc commented 1 year ago

I have properly installed mujoco_py in my system and also checked with example code, which is working fine. But when I am running the custom code, its showing this error. The same custom code is working fine in my other system.

Traceback (most recent call last): File "test_simple.py", line 9, in env = SingleLegEnv() File "/home/pramod/To train_128/mujoco_single_leg_training/env/single_leg_env.py", line 66, in init self.action_space = spaces.Box( TypeError: init() got an unexpected keyword argument 'dtype' Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/pramod/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/gym/utils/closer.py", line 67, in close closeable.close() File "/home/pramod/To train_128/mujoco_single_leg_training/env/mujoco_env.py", line 161, in close if self.viewer is not None: AttributeError: 'SingleLegEnv' object has no attribute 'viewer' Exception ignored in: <function Env.del at 0x7f133e9528b0> Traceback (most recent call last): File "/home/pramod/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/gym/core.py", line 252, in del self.close() File "/home/pramod/To train_128/mujoco_single_leg_training/env/mujoco_env.py", line 161, in close if self.viewer is not None: AttributeError: 'SingleLegEnv' object has no attribute 'viewer'