{"id":13630200,"url":"https://github.com/openai/mujoco-py","last_synced_at":"2025-05-13T19:10:45.914Z","repository":{"id":38238808,"uuid":"56986017","full_name":"openai/mujoco-py","owner":"openai","description":"MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.","archived":false,"fork":false,"pushed_at":"2023-12-10T12:47:21.000Z","size":5823,"stargazers_count":2982,"open_issues_count":428,"forks_count":822,"subscribers_count":198,"default_branch":"master","last_synced_at":"2025-04-28T00:48:31.720Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Cython","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-04-24T17:55:58.000Z","updated_at":"2025-04-27T18:59:40.000Z","dependencies_parsed_at":"2023-01-22T00:20:36.427Z","dependency_job_id":"1d46f351-9bae-40b7-8582-45975accdb10","html_url":"https://github.com/openai/mujoco-py","commit_stats":{"total_commits":209,"total_committers":34,"mean_commits":6.147058823529412,"dds":0.8229665071770335,"last_synced_commit":"a13903b82f1ab316815e63b3575526005b3b2ae1"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fmujoco-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fmujoco-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fmujoco-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fmujoco-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openai","download_url":"https://codeload.github.com/openai/mujoco-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010823,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T22:01:33.469Z","updated_at":"2025-05-13T19:10:45.896Z","avatar_url":"https://github.com/openai.png","language":"Cython","funding_links":[],"categories":["Cython","Papers","Mechanics","[MuJoCo](https://mujoco.org)"],"sub_categories":["NeurIPS 2021","ICML 2023","ICML 2022","Rigid Bodies and Physics Engines"],"readme":"**Status**: Deprecated\n\n### `mujoco-py` does not support versions of MuJoCo after 2.1.0.\n\n### New users should depend on the [official MuJoCo Python bindings](https://github.com/deepmind/mujoco/blob/main/python/README.md).\n\n# mujoco-py [![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://openai.github.io/mujoco-py/build/html/index.html) [![Build Status](https://travis-ci.org/openai/mujoco-py.svg?branch=master)](https://travis-ci.org/openai/mujoco-py)\n\n[MuJoCo](http://mujoco.org/) is a physics engine for detailed, efficient rigid body simulations with contacts.\n`mujoco-py` allows using MuJoCo from Python 3.\n\nThis library has been updated to be compatible with MuJoCo version 2.1 released on 2021-10-18.\n\n\n## Synopsis\n\n### Requirements\n\nThe following platforms are currently supported:\n\n- Linux with Python 3.6+. See [the `Dockerfile`](Dockerfile) for the canonical list of system dependencies.\n- OS X with Python 3.6+.\n\nThe following platforms are DEPRECATED and unsupported:\n\n- Windows support has been DEPRECATED and removed in [2.0.2.0](https://github.com/openai/mujoco-py/releases/tag/v2.0.2.0a1). One known good past version is [1.50.1.68](https://github.com/openai/mujoco-py/blob/9ea9bb000d6b8551b99f9aa440862e0c7f7b4191/README.md#requirements).\n- Python 2 has been DEPRECATED and removed in [1.50.1.0](https://github.com/openai/mujoco-py/releases/tag/1.50.1.0). Python 2 users can stay on the [`0.5` branch](https://github.com/openai/mujoco-py/tree/0.5). The latest release there is [`0.5.7`](https://github.com/openai/mujoco-py/releases/tag/0.5.7) which can be installed with `pip install mujoco-py==0.5.7`.\n\n### Install MuJoCo\n\n1. Download the MuJoCo version 2.1 binaries for\n   [Linux](https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz) or\n   [OSX](https://mujoco.org/download/mujoco210-macos-x86_64.tar.gz).\n1. Extract the downloaded `mujoco210` directory into `~/.mujoco/mujoco210`.\n\nIf you want to specify a nonstandard location for the package,\nuse the env variable `MUJOCO_PY_MUJOCO_PATH`.\n\n### Install and use `mujoco-py`\nTo include `mujoco-py` in your own package, add it to your requirements like so:\n```\nmujoco-py\u003c2.2,\u003e=2.1\n```\nTo play with `mujoco-py` interactively, follow these steps:\n```\n$ pip3 install -U 'mujoco-py\u003c2.2,\u003e=2.1'\n$ python3\nimport mujoco_py\nimport os\nmj_path = mujoco_py.utils.discover_mujoco()\nxml_path = os.path.join(mj_path, 'model', 'humanoid.xml')\nmodel = mujoco_py.load_model_from_path(xml_path)\nsim = mujoco_py.MjSim(model)\n\nprint(sim.data.qpos)\n# [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n\nsim.step()\nprint(sim.data.qpos)\n# [-2.09531783e-19  2.72130735e-05  6.14480786e-22 -3.45474715e-06\n#   7.42993721e-06 -1.40711141e-04 -3.04253586e-04 -2.07559344e-04\n#   8.50646247e-05 -3.45474715e-06  7.42993721e-06 -1.40711141e-04\n#  -3.04253586e-04 -2.07559344e-04 -8.50646247e-05  1.11317030e-04\n#  -7.03465386e-05 -2.22862221e-05 -1.11317030e-04  7.03465386e-05\n#  -2.22862221e-05]\n```\n\nSee the [full documentation](https://openai.github.io/mujoco-py/build/html/index.html) for advanced usage.\n\n## Troubleshooting\n\n### You're on MacOS and you see `clang: error: unsupported option '-fopenmp'`\n\nIf this happend during installation or just running `python -c \"import mujoco_py\"` then the issue seems to be related to [this](https://github.com/velocyto-team/velocyto.R/issues/2#issuecomment-341165967) and the TL;DR is that for macOS the default compiler Apple clang LLVM does not support openmp. So you can try to install another clang/llvm installation. For example (requires [brew](https://brew.sh/)):\n\n```bash\nbrew install llvm\nbrew install boost\nbrew install hdf5\n\n# Add this to your .bashrc/.zshrc:\nexport PATH=\"/usr/local/opt/llvm/bin:$PATH\"\n\nexport CC=\"/usr/local/opt/llvm/bin/clang\"\nexport CXX=\"/usr/local/opt/llvm/bin/clang++\"\nexport CXX11=\"/usr/local/opt/llvm/bin/clang++\"\nexport CXX14=\"/usr/local/opt/llvm/bin/clang++\"\nexport CXX17=\"/usr/local/opt/llvm/bin/clang++\"\nexport CXX1X=\"/usr/local/opt/llvm/bin/clang++\"\n\nexport LDFLAGS=\"-L/usr/local/opt/llvm/lib\"\nexport CPPFLAGS=\"-I/usr/local/opt/llvm/include\"\n```\n\n**Note:** Don't forget to source your `.bashrc/.zshrc` after editing it and try to install `mujoco-py` again:\n\n```bash\n# Make sure your python environment is activated\npip install -U 'mujoco-py\u003c2.2,\u003e=2.1'\n```\n\n### Missing GLFW\n\nA common error when installing is:\n\n    raise ImportError(\"Failed to load GLFW3 shared library.\")\n\nWhich happens when the `glfw` python package fails to find a GLFW dynamic library.\n\nMuJoCo ships with its own copy of this library, which can be used during installation.\n\nAdd the path to the mujoco bin directory to your dynamic loader:\n\n    LD_LIBRARY_PATH=$HOME/.mujoco/mujoco210/bin pip install mujoco-py\n\nThis is particularly useful on Ubuntu 14.04, which does not have a GLFW package.\n\n\n### Ubuntu installtion troubleshooting\n\nBecause `mujoco_py` has compiled native code that needs to be linked to a supplied MuJoCo binary, it's installation\non linux can be more challenging than pure Python source packages.\n\nTo install mujoco-py on Ubuntu, make sure you have the following libraries installed:\n\n    sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3\n\nIf you installed above libraries and you still see an error that `-lGL` cannot be found, most likely you need\nto create the symbolic link directly:\n\n    sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so\n\n\n## Usage Examples\n\nA number of examples demonstrating some advanced features of `mujoco-py` can be found in [`examples/`](/./examples/). These include:\n- [`body_interaction.py`](./examples/body_interaction.py): shows interactions between colliding bodies\n- [`disco_fetch.py`](./examples/disco_fetch.py): shows how `TextureModder` can be used to randomize object textures\n- [`internal_functions.py`](./examples/internal_functions.py): shows how to call raw mujoco functions like `mjv_room2model`\n- [`markers_demo.py`](./examples/markers_demo.py): shows how to add visualization-only geoms to the viewer\n- [`serialize_model.py`](./examples/serialize_model.py): shows how to save and restore a model\n- [`setting_state.py`](./examples/setting_state.py):  shows how to reset the simulation to a given state\n- [`tosser.py`](./examples/tosser.py): shows a simple actuated object sorting robot application\n\nSee the [full documentation](https://openai.github.io/mujoco-py/build/html/index.html) for advanced usage.\n\n## Development\n\nTo run the provided unit and integrations tests:\n\n```\nmake test\n```\n\nTo test GPU-backed rendering, run:\n\n```\nmake test_gpu\n```\n\nThis is somewhat dependent on internal OpenAI infrastructure at the moment, but it should run if you change the `Makefile` parameters for your own setup.\n\n## Changelog\n\n- 03/08/2018: We removed MjSimPool, because most of benefit one can get with multiple processes having single simulation.\n\n## Credits\n\n`mujoco-py` is maintained by the OpenAI Robotics team. Contributors include:\n\n- Alex Ray\n- Bob McGrew\n- Jonas Schneider\n- Jonathan Ho\n- Peter Welinder\n- Wojciech Zaremba\n- Jerry Tworek\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenai%2Fmujoco-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenai%2Fmujoco-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenai%2Fmujoco-py/lists"}