pip install mujoco-py
would only build with gcc8. On Mac, use ll /usr/local/Cellar/gcc* to find all gcc versions you have installed. Uninstall them and only install gcc@8.
brew uninstall gcc
brew uninstall gcc@7
brew uninstall gcc@9
brew install gcc@8
Another time I saw the following error when using pip install mujoco-py
:
Building wheel for mujoco-py (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /Users/czxttkl/anaconda2/envs/softlearning/bin/python /Users/czxttkl/anaconda2/envs/softlearning/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/tmp8nhhe2ui
cwd: /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py
Complete output (34 lines):
running bdist_wheel
running build
Removing old mujoco_py cext /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/cymj_2.0.2.9_37_macextensionbuilder_37.so
Compiling /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/cymj.pyx because it depends on /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-build-env-phfzl25m/overlay/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd.
[1/1] Cythonizing /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/cymj.pyx
running build_ext
building 'mujoco_py.cymj' extension
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py
creating /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/gl
/usr/local/bin/gcc-8 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/czxttkl/anaconda2/envs/softlearning/include -arch x86_64 -I/Users/czxttkl/anaconda2/envs/softlearning/include -arch x86_64 -DONMAC -Imujoco_py -I/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py -I/Users/czxttkl/.mujoco/mujoco200/include -I/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-build-env-phfzl25m/overlay/lib/python3.7/site-packages/numpy/core/include -I/Users/czxttkl/anaconda2/envs/softlearning/include/python3.7m -c /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/cymj.c -o /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.9_37_macextensionbuilder/temp.macosx-10.9-x86_64-3.7/private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/cymj.o -fopenmp -w
In file included from /usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/syslimits.h:7,
from /usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/limits.h:34,
from /Users/czxttkl/anaconda2/envs/softlearning/include/python3.7m/Python.h:11,
from /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/cymj.c:58:
/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/limits.h:194:61: error: no include path in which to search for limits.h
#include_next <limits.h> /* recurse down to the real one */
^
In file included from /Users/czxttkl/anaconda2/envs/softlearning/include/python3.7m/Python.h:25,
from /private/var/folders/kt/bt_h1rbx0658mqgh49cmt1xwb9g9_0/T/pip-install-g5afauff/mujoco-py/mujoco_py/cymj.c:58:
/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
#include <_stdio.h>
^~~~~~~~~~
compilation terminated.
error: command '/usr/local/bin/gcc-8' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mujoco-py
Failed to build mujoco-py
ERROR: Could not build wheels for mujoco-py which use PEP 517 and cannot be installed directly
This error is suspected to be due to a corrupted gcc@8. I solved this by using brew reinstall gcc@8
.
However during the reinstallation, I encountered another error:
Error: Your Xcode (11.0) is outdated.
Please update to Xcode 11.3 (or delete it).
Xcode can be updated from the App Store.
, which I solved by using xcode-select –install.