openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.83k stars 810 forks source link

Support for Mujoco 2.1.0 #642

Closed isaacanthony closed 2 years ago

isaacanthony commented 2 years ago

Will this library be updated to support DeepMind's open-source Mujoco v2.1.0? We no longer should need to register a Mujoco license or provide a mjkey.txt.

JeanElsner commented 2 years ago

I managed to compile mujoco-py against 2.1.0 and it doesn't seem to break anything. Basically, you have to regenerate the wrappers and add some new definitions to the headers in pxi. Well, there are a few smaller incompatibilities to overcome in order to get it running, like you have to add typedefs to the mujoco headers, but nothing too major.

Btw, a free licence for legacy versions is available roboti.us

traversaro commented 2 years ago

Related PR: https://github.com/openai/mujoco-py/pull/640 .

Kaixhin commented 2 years ago

If we're planning to move forward with MuJoCo versions, would be nice if this could be fixed: https://github.com/openai/gym/issues/1541

Jim-Song commented 2 years ago

cant wait to use mujoco-py 2.1

paantya commented 2 years ago

https://github.com/openai/mujoco-py/issues/648

wookayin commented 2 years ago

Until OpenAI publishes mujoco-py 2.1 release to pypi (please make a release ASAP when it's ready!), you can install a HEAD version of mujoco-py that supports MuJoCo 2.1:

pip install git+https://github.com/openai/mujoco-py 

Update: Don't forget export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin.

paantya commented 2 years ago

@wookayin have you met someone like this?

pip install git+https://github.com/openai/mujoco-py

Collecting git+https://github.com/openai/mujoco-py
  Cloning https://github.com/openai/mujoco-py to /tmp/pip-req-build-1czqutk0
  Running command git clone --filter=blob:none -q https://github.com/openai/mujoco-py /tmp/pip-req-build-1czqutk0
  Resolved https://github.com/openai/mujoco-py to commit fb4babe73b1ef18b4bea4c6f36f6307e06335a2f
  Installing build dependencies ... done
  WARNING: Missing build requirements in pyproject.toml for git+https://github.com/openai/mujoco-py.
  WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting glfw>=1.4.0
  Using cached glfw-2.4.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-manylinux2014_x86_64.whl (205 kB)
Collecting fasteners~=0.15
  Using cached fasteners-0.16.3-py2.py3-none-any.whl (28 kB)
Requirement already satisfied: imageio>=2.1.2 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (2.9.0)
Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (1.19.5)
Requirement already satisfied: cffi>=1.10 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (1.14.6)
Requirement already satisfied: Cython>=0.27.2 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (0.29.24)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.10->mujoco-py==2.0.2.13) (2.20)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from fasteners~=0.15->mujoco-py==2.0.2.13) (1.15.0)
Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from imageio>=2.1.2->mujoco-py==2.0.2.13) (6.2.2)
Building wheels for collected packages: mujoco-py
  Building wheel for mujoco-py (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpse7p29br
       cwd: /tmp/pip-req-build-1czqutk0
  Complete output (48 lines):
  running bdist_wheel
  running build
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
      metadata_directory)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 222, in build_wheel
      wheel_directory, config_settings)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
      self.run_setup()
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 259, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 51, in <module>
      'Programming Language :: Python :: 3 :: Only',
    File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/dist-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "setup.py", line 29, in run
      import mujoco_py  # noqa: force build
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/__init__.py", line 2, in <module>
      from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/builder.py", line 504, in <module>
      cymj = load_cython_ext(mujoco_path)
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/builder.py", line 74, in load_cython_ext
      _ensure_set_env_var("LD_LIBRARY_PATH", lib_path)
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/builder.py", line 124, in _ensure_set_env_var
      var_name, var_name, lib_path))
  Exception:
  Missing path to your environment variable.
  Current values LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
  Please add following line to .bashrc:
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin
  ----------------------------------------
  ERROR: Failed building wheel for mujoco-py
Failed to build mujoco-py
ERROR: Could not build wheels for mujoco-py, which is required to install pyproject.toml-based projects
Note: you may need to restart the kernel to use updated packages.
HasarinduPerera commented 2 years ago

@paantya I'm having the same issue.

wookayin commented 2 years ago

@paantya @HasarinduPerera Your issues are not relevant to mujoco 2.1.0 or this issue. Read the instructions or error message carefully: you'll need to add

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin
HasarinduPerera commented 2 years ago

@wookayin Thank you! It worked.

HACLANG commented 2 years ago

pip3 install git+https://github.com/openai/mujoco-py

@wookayin你遇到过这样的人吗?

pip install git+https://github.com/openai/mujoco-py

Collecting git+https://github.com/openai/mujoco-py
  Cloning https://github.com/openai/mujoco-py to /tmp/pip-req-build-1czqutk0
  Running command git clone --filter=blob:none -q https://github.com/openai/mujoco-py /tmp/pip-req-build-1czqutk0
  Resolved https://github.com/openai/mujoco-py to commit fb4babe73b1ef18b4bea4c6f36f6307e06335a2f
  Installing build dependencies ... done
  WARNING: Missing build requirements in pyproject.toml for git+https://github.com/openai/mujoco-py.
  WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting glfw>=1.4.0
  Using cached glfw-2.4.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-manylinux2014_x86_64.whl (205 kB)
Collecting fasteners~=0.15
  Using cached fasteners-0.16.3-py2.py3-none-any.whl (28 kB)
Requirement already satisfied: imageio>=2.1.2 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (2.9.0)
Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (1.19.5)
Requirement already satisfied: cffi>=1.10 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (1.14.6)
Requirement already satisfied: Cython>=0.27.2 in /usr/local/lib/python3.7/dist-packages (from mujoco-py==2.0.2.13) (0.29.24)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.10->mujoco-py==2.0.2.13) (2.20)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from fasteners~=0.15->mujoco-py==2.0.2.13) (1.15.0)
Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from imageio>=2.1.2->mujoco-py==2.0.2.13) (6.2.2)
Building wheels for collected packages: mujoco-py
  Building wheel for mujoco-py (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpse7p29br
       cwd: /tmp/pip-req-build-1czqutk0
  Complete output (48 lines):
  running bdist_wheel
  running build
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
      metadata_directory)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 222, in build_wheel
      wheel_directory, config_settings)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
      self.run_setup()
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 259, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 51, in <module>
      'Programming Language :: Python :: 3 :: Only',
    File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/dist-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "setup.py", line 29, in run
      import mujoco_py  # noqa: force build
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/__init__.py", line 2, in <module>
      from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/builder.py", line 504, in <module>
      cymj = load_cython_ext(mujoco_path)
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/builder.py", line 74, in load_cython_ext
      _ensure_set_env_var("LD_LIBRARY_PATH", lib_path)
    File "/tmp/pip-req-build-1czqutk0/mujoco_py/builder.py", line 124, in _ensure_set_env_var
      var_name, var_name, lib_path))
  Exception:
  Missing path to your environment variable.
  Current values LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
  Please add following line to .bashrc:
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin
  ----------------------------------------
  ERROR: Failed building wheel for mujoco-py
Failed to build mujoco-py
ERROR: Could not build wheels for mujoco-py, which is required to install pyproject.toml-based projects
Note: you may need to restart the kernel to use updated packages.

Direct downloads https://github.com/openai/mujoco-py/archive/refs/heads/master.zip unzip mujoco-py-master.zip cd mujoco-py sudo make

you can see :

-- Docs: https://docs.pytest.org/en/stable/warnings.html ================= 55 passed, 18 warnings in 192.77s (0:03:12) ================== hello finish