Mujoco-py: ERROR: Could not build wheels for mujoco-py which use PEP 517 and cannot be installed directly

Created on 11 Dec 2019  路  22Comments  路  Source: openai/mujoco-py

Trying to install with pip in a fresh conda env with installed gym.

channels:
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - ca-certificates=2019.11.27=0
  - certifi=2019.11.28=py38_0
  - libedit=3.1.20181209=hc058e9b_0
  - libffi=3.2.1=hd88cf55_4
  - libgcc-ng=9.1.0=hdf63c60_0
  - libstdcxx-ng=9.1.0=hdf63c60_0
  - ncurses=6.1=he6710b0_1
  - openssl=1.1.1d=h7b6447c_3
  - pip=19.3.1=py38_0
  - python=3.8.0=h0371630_2
  - readline=7.0=h7b6447c_5
  - setuptools=42.0.2=py38_0
  - sqlite=3.30.1=h7b6447c_0
  - tk=8.6.8=hbc83047_0
  - wheel=0.33.6=py38_0
  - xz=5.2.4=h14c3975_4
  - zlib=1.2.11=h7b6447c_3
  - pip:
    - cloudpickle==1.2.2
    - future==0.18.2
    - gym==0.15.4
    - numpy==1.17.4
    - opencv-python==4.1.2.30
    - pyglet==1.3.2
    - scipy==1.3.3
    - six==1.13.0

Most helpful comment

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

All 22 comments

I tried:

pip install mujoco_py

pip install -U 'mujoco-py<2.1,>=2.0'

Also downgrading to python 3.6 did not help.

On Ubuntu 18.04 running in WSL under Windows10

Same, on MacOS Catalina

same problem with windows 10

Same problem in linux, trying to install pupil-detectors

The same on Ubuntu 18.04.
Why it is closed?

Same problem, ArchLinux

Same on Google Colab.

Same on Windows 10

From Ubuntu 18, installed fresh on a couple machines with varied experiences over a few weeks...one worked with pip install mujoco-py=2.0.2.7; another worked by cloning the repo and installing; but yet another had successful cloned-repo install but ran into the gcc error on importing mujoco_py (like in #501), which was finally resolved by apt install gcc, which put a new gcc-7 on the machine, then pip install mujoco-py gave hints through a series of missing libraries like patchelf (apt-get install patchelf) and -lGL (apt-get install libglu1-mesa-dev mesa-common-dev), and finally success.

Not sure that reproduces, but hope it helps!

Updating the gcc worked for me; OS Catalina

From Ubuntu 18, installed fresh on a couple machines with varied experiences over a few weeks...one worked with pip install mujoco-py=2.0.2.7; another worked by cloning the repo and installing; but yet another had successful cloned-repo install but ran into the gcc error on importing mujoco_py (like in #501), which was finally resolved by apt install gcc, which put a new gcc-7 on the machine, then pip install mujoco-py gave hints through a series of missing libraries like patchelf (apt-get install patchelf) and -lGL (apt-get install libglu1-mesa-dev mesa-common-dev), and finally success.

Not sure that reproduces, but hope it helps!

does anyone know how to fix this on Google Cloud Platform? have exact same error.

I don't konw this is right or not...but, it worked for me.
details see here, point 4, 5
https://github.com/reinforcement-learning-kr/pg_travel/wiki/Installing-Mujoco-py-on-Linux
first download MuJoCo-pro 150 version, see more on the website above.
and then Install mujoco_py
$ git clone https://github.com/openai/mujoco-py.git
$ cd mujoco-py
$ python3 setup.py install

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

It worked for me ! Thank you!
Note that i use Mac OS Mojave.

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

It worked for me ! Thank you!
Note that i use Win10

I don't konw this is right or not...but, it worked for me.
details see here, point 4, 5
https://github.com/reinforcement-learning-kr/pg_travel/wiki/Installing-Mujoco-py-on-Linux
first download MuJoCo-pro 150 version, see more on the website above.
and then Install mujoco_py
$ git clone https://github.com/openai/mujoco-py.git
$ cd mujoco-py
$ python3 setup.py install

Thanks! In conjunction with this:
https://github.com/ethz-asl/reinmav-gym/issues/35

Worked for me on ubuntu 16

pip install mujoco_py==2.0.2.8 also worked for me but in a test.py file I'm still not able to run import mujoco_py in my virtual environment where mujoco_py installed successfully. Any advice?

Error on python3 test.py

  File "test.py", line 1, in <module>
    import mujoco_py
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/__init__.py", line 3, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/builder.py", line 506, in <module>
    cymj = load_cython_ext(mujoco_path)
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/builder.py", line 105, in load_cython_ext
    cext_so_path = builder.build()
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/builder.py", line 221, in build
    built_so_file_path = self._build_impl()
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/builder.py", line 334, in _build_impl
    so_file_path = super()._build_impl()
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/builder.py", line 244, in _build_impl
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/mujoco_py/builder.py", line 144, in build_extensions
    build_ext.build_extensions(self)
  File "/Users/qliu/Documents/agihome.com/robosuite_env/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/usr/local/opt/llvm/bin/clang' failed with exit status 1

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

work on MacOs, thank you!

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

Installation worked. But I got CompileError when trying to import the module. T.T

Edit: Solved the issue by removing all versions of installed gcc and then following the steps in README to install llvm and to set up the environment variables.

Same problem for me with the most recent release (mujoco 2.0.2.9). pip install mujoco_py==2.0.2.8 worked.

Thank you! This version works.

@soerendip This issue should really be re-opened. Why have you closed it in the first place? Not sure if the authors of the package are even aware of the problem since newer packages are released continuously (the most recent is 2.0.2.13). Just downgrading to a much older version is only a workaround and might cause problems in the future.

@soerendip This issue should really be re-opened. Why have you closed it in the first place? Not sure if the authors of the package are even aware of the problem since newer packages are released continuously (the most recent is 2.0.2.13). Just downgrading to a much older version is only a workaround and might cause problems in the future.

Wish the authors of the package be aware of this issue.
Installing the latest mujoco-py as of March 24, 2021 still has the same issue. Need to downgrade to 2.0.2.8 as a workaround.

Was this page helpful?
0 / 5 - 0 ratings