Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distutils.errors.CompileError: command 'gcc' failed with exit status 1 #297

Closed
xpsqq opened this issue Sep 26, 2018 · 5 comments
Closed

Comments

@xpsqq
Copy link

xpsqq commented Sep 26, 2018

I am trying to install mujoco-py. when import mujoco_py, we get an error message of “distutils.errors.CompileError: command 'gcc' failed with exit status 1"。 Here is the detail

`import mujoco_py
running build_ext
building 'mujoco_py.cymj' extension
gcc -pthread -B /root/anaconda3/envs/py35/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py -I/root/.mujoco/mjpro150/include -I/root/anaconda3/envs/py35/lib/python3.5/site-packages/numpy/core/include -I/root/anaconda3/envs/py35/include/python3.5m -c /root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/cymj.c -o /root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/generated/_pyxbld_1.50.1.56_35_linuxcpuextensionbuilder/temp.linux-x86_64-3.5/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/cymj.o -fopenmp -w
gcc -pthread -B /root/anaconda3/envs/py35/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py -I/root/.mujoco/mjpro150/include -I/root/anaconda3/envs/py35/lib/python3.5/site-packages/numpy/core/include -I/root/anaconda3/envs/py35/include/python3.5m -c /root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/gl/osmesashim.c -o /root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/generated/_pyxbld_1.50.1.56_35_linuxcpuextensionbuilder/temp.linux-x86_64-3.5/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/gl/osmesashim.o -fopenmp -w
/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/gl/osmesashim.c:1:10: fatal error: GL/osmesa.h: No such file or directory
#include <GL/osmesa.h>
^~~~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/unixccompiler.py", line 118, in _compile
extra_postargs)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/spawn.py", line 159, in _spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/init.py", line 1, in
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/builder.py", line 468, in
cymj = load_cython_ext(mjpro_path)
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/builder.py", line 90, in load_cython_ext
cext_so_path = builder.build()
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/builder.py", line 202, in build
built_so_file_path = self._build_impl()
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/builder.py", line 256, in _build_impl
so_file_path = super()._build_impl()
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/builder.py", line 225, in _build_impl
dist.run_commands()
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/mujoco_py/builder.py", line 125, in build_extensions
build_ext.build_extensions(self)
File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/command/build_ext.py", line 533, in build_extension
depends=ext.depends)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/root/anaconda3/envs/py35/lib/python3.5/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1`

We installed python=3.5.4, gym=0.10.5, anaconda=4.5.11, gcc =7.3.0. The mujoco150 has been downloaded and unzipped to the directory ”~/.mujoco/mjpro150", and we add a line in the .bashrc “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin"

We tried everything in these website but still get the error.
https://github.com/openai/mujoco-py/issues/53

@machinaut
Copy link
Contributor

you're missing the "GL/osmesa.h" header file, which is installed by a different package.

where are your mesa library headers installed?

@machinaut
Copy link
Contributor

closing because I'm pretty sure this means mesa headers are not installed.

please reopen if this is not the case, though!

@jp18813100494
Copy link

hello ,can

closing because I'm pretty sure this means mesa headers are not installed.

please reopen if this is not the case, though!

hello ,can you help me how to install "GL/osmesa.h",I meet the same question like it!

@nflu
Copy link

nflu commented Jan 25, 2019

Solution is here

sudo apt install libosmesa6-dev

worked for me

@sarthakgurnani9
Copy link

I'm unable to solve this issue. I'm using a Mac and jypter notebook through anaconda. could anyone help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants