Mujoco-py: Failed building wheel for mujoco-py

Created on 31 May 2019  ยท  2Comments  ยท  Source: openai/mujoco-py

I am really new to both Linux and MuJoCo and I am really sorry to bother you guys.

I follow the tutorial from the readme in git.

Put the unzipped folder here:

tree .mujoco/
.mujoco/
โ”œโ”€โ”€ mjkey.txt
โ””โ”€โ”€ mujoco200
    โ”œโ”€โ”€ bin
    โ”‚ย ย  โ”œโ”€โ”€ basic
    โ”‚ย ย  โ”œโ”€โ”€ compile
    โ”‚ย ย  โ”œโ”€โ”€ derivative
    โ”‚ย ย  โ”œโ”€โ”€ libglewegl.so
    โ”‚ย ย  โ”œโ”€โ”€ libglewosmesa.so
    โ”‚ย ย  โ”œโ”€โ”€ libglew.so
    โ”‚ย ย  โ”œโ”€โ”€ libglfw3.a
    โ”‚ย ย  โ”œโ”€โ”€ libglfw.so.3
    โ”‚ย ย  โ”œโ”€โ”€ libmujoco200nogl.so
    โ”‚ย ย  โ”œโ”€โ”€ libmujoco200.so
    โ”‚ย ย  โ”œโ”€โ”€ record
    โ”‚ย ย  โ”œโ”€โ”€ simulate
    โ”‚ย ย  โ”œโ”€โ”€ testspeed
    โ”‚ย ย  โ””โ”€โ”€ testxml
    โ”œโ”€โ”€ doc
    โ”‚ย ย  โ”œโ”€โ”€ README.txt
    โ”‚ย ย  โ””โ”€โ”€ REFERENCE.txt
    โ”œโ”€โ”€ include
    โ”‚ย ย  โ”œโ”€โ”€ glfw3.h
    โ”‚ย ย  โ”œโ”€โ”€ mjdata.h
    โ”‚ย ย  โ”œโ”€โ”€ mjmodel.h
    โ”‚ย ย  โ”œโ”€โ”€ mjrender.h
    โ”‚ย ย  โ”œโ”€โ”€ mjui.h
    โ”‚ย ย  โ”œโ”€โ”€ mjvisualize.h
    โ”‚ย ย  โ”œโ”€โ”€ mjxmacro.h
    โ”‚ย ย  โ”œโ”€โ”€ mujoco.h
    โ”‚ย ย  โ”œโ”€โ”€ uitools.c
    โ”‚ย ย  โ””โ”€โ”€ uitools.h
    โ”œโ”€โ”€ model
    โ”‚ย ย  โ”œโ”€โ”€ arm26.xml
    โ”‚ย ย  โ”œโ”€โ”€ carpet.png
    โ”‚ย ย  โ”œโ”€โ”€ cloth.xml
    โ”‚ย ย  โ”œโ”€โ”€ grid1pin.xml
    โ”‚ย ย  โ”œโ”€โ”€ grid1.xml
    โ”‚ย ย  โ”œโ”€โ”€ grid2pin.xml
    โ”‚ย ย  โ”œโ”€โ”€ grid2.xml
    โ”‚ย ย  โ”œโ”€โ”€ hammock.xml
    โ”‚ย ย  โ”œโ”€โ”€ humanoid100.xml
    โ”‚ย ย  โ”œโ”€โ”€ humanoid.xml
    โ”‚ย ย  โ”œโ”€โ”€ loop.xml
    โ”‚ย ย  โ”œโ”€โ”€ marble.png
    โ”‚ย ย  โ”œโ”€โ”€ particle.xml
    โ”‚ย ย  โ”œโ”€โ”€ rope.xml
    โ”‚ย ย  โ”œโ”€โ”€ scene.xml
    โ”‚ย ย  โ”œโ”€โ”€ softbox.xml
    โ”‚ย ย  โ”œโ”€โ”€ softcylinder.xml
    โ”‚ย ย  โ”œโ”€โ”€ softellipsoid.xml
    โ”‚ย ย  โ””โ”€โ”€ sponge.png
    โ””โ”€โ”€ sample
        โ”œโ”€โ”€ basic.cpp
        โ”œโ”€โ”€ compile.cpp
        โ”œโ”€โ”€ derivative.cpp
        โ”œโ”€โ”€ makefile
        โ”œโ”€โ”€ mjx.cpp
        โ”œโ”€โ”€ mjxmake.m
        โ”œโ”€โ”€ record.cpp
        โ”œโ”€โ”€ simulate.cpp
        โ”œโ”€โ”€ testspeed.cpp
        โ””โ”€โ”€ testxml.cpp

I try to change the envrionment variable first but it didn't work. So I put the folder back to where it is instructed, the .mujoco folder. Checking that I have cleared the variable I set before with printenv | grep mujoco, prints the following:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/maco/.mujoco/mujoco200/bin:/home/maco/.mujoco/bin
OLDPWD=/home/maco/mujoco-py

Then I run pip3 install -U 'mujoco-py<2.1,>=2.0' --user and get the following error:

Collecting mujoco-py<2.1,>=2.0
  Using cached https://files.pythonhosted.org/packages/a9/c8/daac2e747a0a516f6a880bf73304bd58e18d8be5cea926e8a1e5938026e6/mujoco-py-2.0.2.2.tar.gz
Requirement already satisfied, skipping upgrade: Cython>=0.27.2 in /usr/local/lib/python3.6/dist-packages (from mujoco-py<2.1,>=2.0) (0.29.9)
Requirement already satisfied, skipping upgrade: cffi>=1.10 in /usr/local/lib/python3.6/dist-packages (from mujoco-py<2.1,>=2.0) (1.12.3)
Requirement already satisfied, skipping upgrade: glfw>=1.4.0 in /usr/local/lib/python3.6/dist-packages (from mujoco-py<2.1,>=2.0) (1.8.1)
Requirement already satisfied, skipping upgrade: imageio>=2.1.2 in /usr/local/lib/python3.6/dist-packages (from mujoco-py<2.1,>=2.0) (2.5.0)
Requirement already satisfied, skipping upgrade: lockfile>=0.12.2 in /usr/local/lib/python3.6/dist-packages (from mujoco-py<2.1,>=2.0) (0.12.2)
Requirement already satisfied, skipping upgrade: numpy>=1.11 in /usr/local/lib/python3.6/dist-packages (from mujoco-py<2.1,>=2.0) (1.15.4)
Requirement already satisfied, skipping upgrade: pycparser in /usr/local/lib/python3.6/dist-packages (from cffi>=1.10->mujoco-py<2.1,>=2.0) (2.19)
Requirement already satisfied, skipping upgrade: pillow in /usr/lib/python3/dist-packages (from imageio>=2.1.2->mujoco-py<2.1,>=2.0) (5.1.0)
Building wheels for collected packages: mujoco-py
  Running setup.py bdist_wheel for mujoco-py ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cby_7arg/mujoco-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-cpg0uj_3 --python-tag cp36:
  running bdist_wheel
  running build
  Removing old mujoco_py cext /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/cymj_2.0.2.2_36_linuxcpuextensionbuilder_36.so
  Compiling /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/cymj.pyx because it depends on /usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd.
  [1/1] Cythonizing /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/cymj.pyx
  running build_ext
  building 'mujoco_py.cymj' extension
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/gl
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Imujoco_py -I/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py -I/home/maco/.mujoco/mujoco200/include -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/cymj.c -o /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/cymj.o -fopenmp -w
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Imujoco_py -I/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py -I/home/maco/.mujoco/mujoco200/include -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/gl/osmesashim.c -o /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/gl/osmesashim.o -fopenmp -w
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/lib.linux-x86_64-3.6
  creating /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/lib.linux-x86_64-3.6/mujoco_py
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/cymj.o /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/temp.linux-x86_64-3.6/tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/gl/osmesashim.o -L/home/maco/.mujoco/mujoco200/bin -Wl,--enable-new-dtags,-R/home/maco/.mujoco/mujoco200/bin -lmujoco200 -lglewosmesa -lOSMesa -lGL -o /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_36_linuxcpuextensionbuilder/lib.linux-x86_64-3.6/mujoco_py/cymj.cpython-36m-x86_64-linux-gnu.so -fopenmp
  error: [Errno 2] No such file or directory: 'patchelf': 'patchelf'

  ----------------------------------------
  Failed building wheel for mujoco-py
  Running setup.py clean for mujoco-py
Failed to build mujoco-py
Installing collected packages: mujoco-py
  Running setup.py install for mujoco-py ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cby_7arg/mujoco-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ucvbjd8a/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    Removing old mujoco_py cext /tmp/pip-install-cby_7arg/mujoco-py/mujoco_py/generated/cymj_2.0.2.2_36_linuxcpuextensionbuilder_36.so
    running build_ext
    error: [Errno 2] No such file or directory: 'patchelf': 'patchelf'

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cby_7arg/mujoco-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ucvbjd8a/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-cby_7arg/mujoco-py/

Thank you a lot!!

Most helpful comment

not OP but I ran into the same error, given the same initial setup (tree .mujoco gives the equivalent output).

This comment onwards shows that you can install the missing utility patchelf through the package manager of your OS distribution. Then retry the pip install command.

Hope that helps anyone else who stumbles on this issue

All 2 comments

@cmacw What was the solution?

not OP but I ran into the same error, given the same initial setup (tree .mujoco gives the equivalent output).

This comment onwards shows that you can install the missing utility patchelf through the package manager of your OS distribution. Then retry the pip install command.

Hope that helps anyone else who stumbles on this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dialogchat picture dialogchat  ยท  3Comments

bebbo203 picture bebbo203  ยท  3Comments

jjkke88 picture jjkke88  ยท  6Comments

yasiemir picture yasiemir  ยท  5Comments

libo-wu picture libo-wu  ยท  3Comments