Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'AssemblyV2GoalObservable' object has no attribute 'sim' #520

Closed
Yushi-Du opened this issue Dec 23, 2024 · 6 comments
Closed

Comments

@Yushi-Du
Copy link

I was trying to run the drawer-open-v2 environment while I got the error below:

Traceback (most recent call last):
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/hydra_launcher.py", line 38, in
configure_jobs()
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/main.py", line 48, in decorated_main
_run_hydra(
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 377, in _run_hydra
run_and_report(
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 294, in run_and_report
raise ex
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 211, in run_and_report
return func()
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 378, in
lambda: hydra.run(
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 111, in run
_ = ret.return_value
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/core/utils.py", line 233, in return_value
raise self._return_value
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/core/utils.py", line 160, in run_job
ret.return_value = task_function(task_cfg)
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/hydra_launcher.py", line 34, in configure_jobs
bc_train_loop(job_data)
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/train_loop.py", line 151, in bc_train_loop
paths = sample_paths(num_traj=job_data['eval_num_traj'], env=e, #env_constructor,
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/sampling.py", line 172, in sample_paths
return do_rollout(**input_dict)
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/sampling.py", line 95, in do_rollout
o = env.reset()
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/gym_env.py", line 91, in reset
return self.env.reset()
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/gym/core.py", line 279, in reset
observation = self.env.reset(**kwargs)
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/gym/core.py", line 280, in reset
return self.observation(observation)
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/obs_wrappers.py", line 399, in observation
return self.get_image()
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/obs_wrappers.py", line 391, in get_image
img = self.sim.render(width=self.width, height=self.height, depth=self.depth,
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/gym/core.py", line 238, in getattr
return getattr(self.env, name)

I wonder if it has something to do with mujoco versions? I would really appreciate your reply and help. Thank you very much.

@Yushi-Du
Copy link
Author

Traceback (most recent call last):
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/hydra_launcher.py", line 38, in
configure_jobs()
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/main.py", line 48, in decorated_main
_run_hydra(
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 377, in _run_hydra
run_and_report(
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 294, in run_and_report
raise ex
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 211, in run_and_report
return func()
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/utils.py", line 378, in
lambda: hydra.run(
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 111, in run
_ = ret.return_value
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/core/utils.py", line 233, in return_value
raise self._return_value
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/hydra/core/utils.py", line 160, in run_job
ret.return_value = task_function(task_cfg)
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/hydra_launcher.py", line 34, in configure_jobs
bc_train_loop(job_data)
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/train_loop.py", line 151, in bc_train_loop
paths = sample_paths(num_traj=job_data['eval_num_traj'], env=e, #env_constructor,
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/sampling.py", line 172, in sample_paths
return do_rollout(**input_dict)
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/sampling.py", line 95, in do_rollout
o = env.reset()
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/gym_env.py", line 91, in reset
return self.env.reset()
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/gym/core.py", line 279, in reset
observation = self.env.reset(**kwargs)
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/gym/core.py", line 280, in reset
return self.observation(observation)
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/obs_wrappers.py", line 399, in observation
return self.get_image()
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/obs_wrappers.py", line 391, in get_image
img = self.sim.render(width=self.width, height=self.height, depth=self.depth,
File "/home/wangyx/miniconda3/envs/mujoco3/lib/python3.10/site-packages/gym/core.py", line 238, in getattr
return getattr(self.env, name)
AttributeError: 'AssemblyV2GoalObservable' object has no attribute 'sim'

@Kallinteris-Andreas
Copy link

What metaworld version are you running

@reginald-mclean
Copy link
Collaborator

This looks like it is from R3M so you will need to install a specific commit of Meta-World that works with R3M. The last command in the installation instructions should work. pip install git+https://github.com/Farama-Foundation/Metaworld.git@04be337a12305e393c0caf0cbf5ec7755c7c8feb

@Yushi-Du
Copy link
Author

Yushi-Du commented Jan 4, 2025

Sorry for replying late, I was handling some personal issues last week.

Thanks a lot! It seems that @reginald-mclean 's solution works for me. I am running metaworld for R3M.

This looks like it is from R3M so you will need to install a specific commit of Meta-World that works with R3M. The last command in the installation instructions should work. pip install git+https://github.com/Farama-Foundation/Metaworld.git@04be337a12305e393c0caf0cbf5ec7755c7c8feb

However, I ran into another issue which may have something to do with mujoco-py version:

Traceback (most recent call last):
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/hydra_launcher.py", line 38, in
configure_jobs()
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/main.py", line 48, in decorated_main
_run_hydra(
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/_internal/utils.py", line 377, in _run_hydra
run_and_report(
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/_internal/utils.py", line 294, in run_and_report
raise ex
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/_internal/utils.py", line 211, in run_and_report
return func()
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/_internal/utils.py", line 378, in
lambda: hydra.run(
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 111, in run
_ = ret.return_value
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/core/utils.py", line 233, in return_value
raise self._return_value
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/hydra/core/utils.py", line 160, in run_job
ret.return_value = task_function(task_cfg)
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/hydra_launcher.py", line 34, in configure_jobs
bc_train_loop(job_data)
File "/home/wangyx/r3m-eval/evaluation/r3meval/core/train_loop.py", line 151, in bc_train_loop
paths = sample_paths(num_traj=job_data['eval_num_traj'], env=e, #env_constructor,
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/sampling.py", line 172, in sample_paths
return do_rollout(**input_dict)
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/sampling.py", line 95, in do_rollout
o = env.reset()
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/gym_env.py", line 91, in reset
return self.env.reset()
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/gym/core.py", line 278, in reset
observation = self.env.reset(**kwargs)
File "/home/wangyx/miniconda3/envs/mujoco5/lib/python3.10/site-packages/gym/core.py", line 279, in reset
return self.observation(observation)
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/obs_wrappers.py", line 399, in observation
return self.get_image()
File "/home/wangyx/r3m-eval/evaluation/r3meval/utils/obs_wrappers.py", line 391, in get_image
img = self.sim.render(width=self.width, height=self.height, depth=self.depth,
File "mjsim.pyx", line 153, in mujoco_py.cymj.MjSim.render
File "wrappers.pxi", line 1071, in mujoco_py.cymj.PyMjModel.camera_name2id
ValueError: No "camera" with name left_cap2 exists. Available "camera" names = ('topview', 'corner', 'corner2', 'corner3', 'behindGripper', 'gripperPOV').

I have tried to install different mujoco-py versions including 2.1.2.14 and 2.0.2.8 but both failed in my case. I would like to ask if you have encountered similar problems?Thank you very much for the reply.

@Kallinteris-Andreas
Copy link

Try passing the camera argument during environment construstion

@reginald-mclean
Copy link
Collaborator

R3M uses a fork of Meta-World that is different from our repo, they add additional cameras as seen here:
suraj-nair-1@4e896a5#diff-c8eec7ed8050fcecdab0f09da27c0236a4ab1abfa80b75b6494096f6c228648b

You can try adding the camera into the relevant locations in the Meta-World version you have or use the fork of Meta-World that R3M uses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants