Skip to content

mjpython on MacOS does not support other 3rd party packages #2505

Open
@Fima2003

Description

@Fima2003

Intro

Hi!

I am an undergrad student at Technion, I use MuJoCo for my research on Robotic arms.

My setup

I am using MuJoCo on python on Mac(M-series chip) with Sequoia 15.3.2, and I cannot import not pre-built packages when running with mjpython

What's happening? What did you expect?

Well, I expected it to run, but it does not

Steps for reproduction

  1. Load the package below.
    pip3 install mink
  2. Run the code below.(with mjpython setup.py)
import mujoco
import mink
import numpy as np


def setup():
    XML_PATH = "ur5e_scene.xml"
    model = mujoco.MjModel.from_xml_path(XML_PATH)
    data = mujoco.MjData(model)

    key_name = "home"
    key_id = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_KEY, key_name)
    if key_id >= 0:
        data.qpos[:] = model.key_qpos[key_id].copy()
        data.ctrl[:] = model.key_ctrl[key_id].copy()

    # Make sure the state is updated:
    mujoco.mj_forward(model, data)

    return model, data

if __name__ == "__main__":
    setup()
  1. See the error
Traceback (most recent call last):
  File "/universal_robots_ur5e/setup.py", line 2, in <module>
    import mink
ModuleNotFoundError: No module named 'mink'

Minimal model for reproduction

The model is not that relevant, to be honest, but for argument's sake, you can use the default one:

minimal XML
<mujoco>
  <worldbody>
    <light pos="0 0 1"/>
    <geom type="sphere" size="1" rgba="1 0 0 1"/>
  </worldbody>
</mujoco>

Code required for reproduction

import mujoco
import mink
import numpy as np


def setup():
    XML_PATH = "ur5e_scene.xml"
    model = mujoco.MjModel.from_xml_path(XML_PATH)
    data = mujoco.MjData(model)

    key_name = "home"
    key_id = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_KEY, key_name)
    if key_id >= 0:
        data.qpos[:] = model.key_qpos[key_id].copy()
        data.ctrl[:] = model.key_ctrl[key_id].copy()

    # Make sure the state is updated:
    mujoco.mj_forward(model, data)

    return model, data

if __name__ == "__main__":
    setup()

Confirmations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions