You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When i try to run a MuJoCo script with mjpython on my Macbook after installing mujoco with the uv package manager, I get an error message. To reproduce the error, I ran the following commands:
# Install `uv` on macOS and Linux.
$ curl -LsSf https://astral.sh/uv/install.sh | sh
# Create project and run mjpython
uv init mujoco-example
cd mujoco-example
uv add mujoco
source .venv/bin/activate
mjpython
The error says the following:
(.venv) jonzamora@mbp mujoco-example % mjpython
failed to dlopen path '/Users/jonzamora/Research/mujoco-example/.venv/bin/python': dlopen(/Users/jonzamora/Research/mujoco-example/.venv/bin/python, 0x000A): Library not loaded: @executable_path/../lib/libpython3.10.dylib
Referenced from: <4C4C44EE-5555-3144-A1A0-28739E256A39> /Users/jonzamora/.local/share/uv/python/cpython-3.10.14-macos-aarch64-none/bin/python3.10
Reason: tried: '/Users/jonzamora/Research/mujoco-example/.venv/lib/python3.10/site-packages/mujoco/MuJoCo (mjpython).app/Contents/lib/libpython3.10.dylib' (no such file), '/Users/jonzamora/Research/mujoco-example/.venv/bin/../lib/libpython3.10.dylib' (no such file), '/libpython3.10.dylib' (no such file)
Of course, you could run mjpython main.py, where main.py is a passive viewer rendering script like this:
importtimeimportmujocoimportmujoco.viewerm=mujoco.MjModel.from_xml_path('/path/to/mjcf.xml')
d=mujoco.MjData(m)
withmujoco.viewer.launch_passive(m, d) asviewer:
# Close the viewer automatically after 30 wall-seconds.start=time.time()
whileviewer.is_running() andtime.time() -start<30:
step_start=time.time()
# mj_step can be replaced with code that also evaluates# a policy and applies a control signal before stepping the physics.mujoco.mj_step(m, d)
# Example modification of a viewer option: toggle contact points every two seconds.withviewer.lock():
viewer.opt.flags[mujoco.mjtVisFlag.mjVIS_CONTACTPOINT] =int(d.time%2)
# Pick up changes to the physics state, apply perturbations, update options from GUI.viewer.sync()
# Rudimentary time keeping, will drift relative to wall clock.time_until_next_step=m.opt.timestep- (time.time() -step_start)
iftime_until_next_step>0:
time.sleep(time_until_next_step)
Any help will be greatly appreciated, i'm sure others are also hoping to use a combination of mujoco and uv on their Macbook machines. Thanks!
My Setup
Operating system + Machine
macOS Sonoma, M3 Max Macbook Pro
MuJoCo version (and if the bug is new, the version where it used to work)
MuJoCo 3.2.2
For Python issues, what bindings are you using (i.e mujoco, dm_control, mujoco-py)?
mujoco
The text was updated successfully, but these errors were encountered:
For comparison, if i create a mamba / conda environment and pip install mujoco, then run mjpython, the expected behavior occurs:
(mujoco) jonzamora@mbp mujoco-example % mjpython
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:51:49) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license"for more information.
Hi,
When i try to run a MuJoCo script with
mjpython
on my Macbook after installingmujoco
with theuv
package manager, I get an error message. To reproduce the error, I ran the following commands:The error says the following:
Of course, you could run
mjpython main.py
, wheremain.py
is a passive viewer rendering script like this:Any help will be greatly appreciated, i'm sure others are also hoping to use a combination of
mujoco
anduv
on their Macbook machines. Thanks!My Setup
mujoco
,dm_control
,mujoco-py
)?mujoco
The text was updated successfully, but these errors were encountered: