AttributeError: module 'mujoco' has no attribute 'viewer' #2877
Answered
by
yaswhar
Enzo-let
asked this question in
Asking for Help
-
IntroHi! I am a undergrad student , I use MuJoCo for my research on iiwa. My setupMuJoCo Python package version: 3.3.6 My questionAttributeError: module 'mujoco' has no attribute 'viewer' Minimal model and/or code that explain my questionIf you encountered the issue in a complex model, please simplify it as much as possible (while still reproducing the issue). Model: minimal XML<mujoco>
<worldbody>
<light pos="0 0 1"/>
<geom type="sphere" size="1" rgba="1 0 0 1"/>
</worldbody>
</mujoco>
Code: import mujoco
xml_path = "/home/let/MujocoTutorials/robot/robot_arms/kuka_iiwa_14/iiwa14.xml"
model = mujoco.MjModel.from_xml_path(xml_path)
data = mujoco.MjData(model)
with mujoco.viewer.launch_passive(model, data) as viewer:
while viewer.is_running():
mujoco.mj_step(model, data)
viewer.sync() Confirmations
|
Beta Was this translation helpful? Give feedback.
Answered by
yaswhar
Sep 25, 2025
Replies: 1 comment 1 reply
-
I think you should just first import it as |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Enzo-let
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you should just first import it as
from mujoco import viewer
and then callviewer.launch_passive(model, data)