Mujoco-py: Errors during pip install mujoco_py

Created on 11 Feb 2019  路  6Comments  路  Source: openai/mujoco-py

Encountering this error when installing on Mac OS:

pip install mujoco-py

In file included from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/syslimits.h:7,
                   from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:34,
                   from /Users/andriy/anaconda3/envs/surreal/include/python3.7m/Python.h:11,
                   from /private/var/folders/qb/fvg5ts7n4y1gplffdfdmmrfm0000gn/T/pip-install-i11b6svg/mujoco-py/mujoco_py/cymj.c:57:
  /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
   #include_next <limits.h>  /* recurse down to the real one */
                 ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/local/bin/gcc-8' failed with exit status 1

Failed building wheel for mujoco-py

In file included from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/syslimits.h:7,
                     from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:34,
                     from /Users/andriy/anaconda3/envs/surreal/include/python3.7m/Python.h:11,
                     from /private/var/folders/qb/fvg5ts7n4y1gplffdfdmmrfm0000gn/T/pip-install-i11b6svg/mujoco-py/mujoco_py/cymj.c:57:
    /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
     #include_next <limits.h>  /* recurse down to the real one */
                   ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/local/bin/gcc-8' failed with exit status 1

    ----------------------------------------
Command "/Users/andriy/anaconda3/envs/surreal/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qb/fvg5ts7n4y1gplffdfdmmrfm0000gn/T/pip-install-i11b6svg/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 /private/var/folders/qb/fvg5ts7n4y1gplffdfdmmrfm0000gn/T/pip-record-zo8q9egp/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qb/fvg5ts7n4y1gplffdfdmmrfm0000gn/T/pip-install-i11b6svg/mujoco-py/

Most helpful comment

I needed to

  1. brew uninstall gcc
    > notifies that there is still a gcc@7 left in the system.
  2. brew uninstall gcc@7
  3. brew install gcc@8
  4. pip install mujoco-py.

important-2019-09-21: @sungsulim is right about the gcc@6. gcc@8 was okay in the past, but for this different macbook I'm using now only the gcc@6 worked.

important: I made a mistake of including /bin in the MJPRO_PATH for mujoco-py. See third-line below:

export LD_LIBRARY_PATH=$HOME/.mujoco/mujoco200/bin:$LD_LIBRARY_PATH
export MUJOCO_PY_MJPRO_PATH=$HOME/.mujoco/mujoco200/
export MUJOCO_PY_MJKEY_PATH=$HOME/.mujoco/mjkey.txt

worked. In addition I had to do

brew uninstall gcc
brew uninstall gcc@8
brew uninstall gcc@9

brew install gcc@6

Only the gcc@6 worked with this installation. OSX version is 10.14.6 (18G87)

Note this is also true on Linux. It seems that mujoco-py likes the path without the platform post-fix, where as DeepMind dm_controlsuite likes it with those post-fixes.

All 6 comments

I've placed the folder mjpro150 into ~/.mujoco and also placed the mjkey.txt in there.

I needed to

  1. brew uninstall gcc
    > notifies that there is still a gcc@7 left in the system.
  2. brew uninstall gcc@7
  3. brew install gcc@8
  4. pip install mujoco-py.

important-2019-09-21: @sungsulim is right about the gcc@6. gcc@8 was okay in the past, but for this different macbook I'm using now only the gcc@6 worked.

important: I made a mistake of including /bin in the MJPRO_PATH for mujoco-py. See third-line below:

export LD_LIBRARY_PATH=$HOME/.mujoco/mujoco200/bin:$LD_LIBRARY_PATH
export MUJOCO_PY_MJPRO_PATH=$HOME/.mujoco/mujoco200/
export MUJOCO_PY_MJKEY_PATH=$HOME/.mujoco/mjkey.txt

worked. In addition I had to do

brew uninstall gcc
brew uninstall gcc@8
brew uninstall gcc@9

brew install gcc@6

Only the gcc@6 worked with this installation. OSX version is 10.14.6 (18G87)

Note this is also true on Linux. It seems that mujoco-py likes the path without the platform post-fix, where as DeepMind dm_controlsuite likes it with those post-fixes.

For me it was somehow using gcc@6 and had to do

  1. brew uninstall gcc
  2. brew uninstall gcc@6
  3. brew install gcc@8
  4. pip3 install mujoco-py

It still did not work for me.
I am trying to run it on a mac and the full error is:

ERROR: Complete output from command /Users/alimarjaninejad/.pyenv/versions/3.5.2/bin/python3.5 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/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 /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-record-y5h4ccie/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
Removing old mujoco_py cext /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/cymj_2.0.2.2_35_macextensionbuilder_35.so
Compiling /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/cymj.pyx because it depends on /Users/alimarjaninejad/.pyenv/versions/3.5.2/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd.
[1/1] Cythonizing /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/cymj.pyx
running build_ext
building 'mujoco_py.cymj' extension
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py
creating /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/gl
/usr/local/bin/gcc-8 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DONMAC -Imujoco_py -I/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py -I/Users/alimarjaninejad/.mujoco/mujoco200/include -I/Users/alimarjaninejad/.pyenv/versions/3.5.2/lib/python3.5/site-packages/numpy/core/include -I/Users/alimarjaninejad/.pyenv/versions/3.5.2/include/python3.5m -c /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/cymj.c -o /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/cymj.o -fopenmp -w
/usr/local/bin/gcc-8 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DONMAC -Imujoco_py -I/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py -I/Users/alimarjaninejad/.mujoco/mujoco200/include -I/Users/alimarjaninejad/.pyenv/versions/3.5.2/lib/python3.5/site-packages/numpy/core/include -I/Users/alimarjaninejad/.pyenv/versions/3.5.2/include/python3.5m -c /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/gl/dummyshim.c -o /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.2_35_macextensionbuilder/temp.macosx-10.14-x86_64-3.5/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/gl/dummyshim.o -fopenmp -w
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:61,
from /Users/alimarjaninejad/.mujoco/mujoco200/include/mujoco.h:33,
from /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/gl/glshim.h:4,
from /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/mujoco_py/gl/dummyshim.c:1:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h:257:22: error: missing binary operator before token "("
#if __has_builtin(__is_target_arch)
^
error: command '/usr/local/bin/gcc-8' failed with exit status 1
----------------------------------------
ERROR: Command "/Users/alimarjaninejad/.pyenv/versions/3.5.2/bin/python3.5 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/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 /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-record-y5h4ccie/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/s6/0_d9s9257qj2dwhc9nfpv0_c0000gn/T/pip-install-v9u6jsps/mujoco-py/

has anyone faced the same problem and found a solution for it?

It worked for me once I installed the pkg mentioned here:
https://stackoverflow.com/questions/51274905/brew-install-on-mojave

I'm still having an issue with Mac OS Catalina 10.15:

error: command '/usr/local/bin/gcc-6' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/opt/python/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-9cr4hkj6/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 /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-record-yj96orw2/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-9cr4hkj6/mujoco-py/

Anyone else experiencing this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cbjtu picture cbjtu  路  5Comments

samuela picture samuela  路  3Comments

heiko0403 picture heiko0403  路  6Comments

henrycharlesworth picture henrycharlesworth  路  5Comments

bebbo203 picture bebbo203  路  3Comments