Open wj210 opened 2 years ago
In my case, I get this error when I import the mujoco_py module in python. I installed the package in a conda environment on Ubuntu 20.04 without any error.
~/.mujoco/mujoco-py/examples$ python3
Python 3.8.13 (default, Mar 28 2022, 11:38:47)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mujoco_py
running build_ext
gcc -pthread -B /home/swagat/anaconda3/envs/mujoco_py/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py -I/home/swagat/.mujoco/mujoco210/include -I/home/swagat/.local/lib/python3.8/site-packages/numpy/core/include -I/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/vendor/egl -I/home/swagat/anaconda3/envs/mujoco_py/include/python3.8 -c /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/cymj.c -o /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxgpuextensionbuilder/temp.linux-x86_64-3.8/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/cymj.o -fopenmp -w
gcc -pthread -B /home/swagat/anaconda3/envs/mujoco_py/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py -I/home/swagat/.mujoco/mujoco210/include -I/home/swagat/.local/lib/python3.8/site-packages/numpy/core/include -I/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/vendor/egl -I/home/swagat/anaconda3/envs/mujoco_py/include/python3.8 -c /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/gl/eglshim.c -o /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxgpuextensionbuilder/temp.linux-x86_64-3.8/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/gl/eglshim.o -fopenmp -w
gcc -pthread -shared -B /home/swagat/anaconda3/envs/mujoco_py/compiler_compat -L/home/swagat/anaconda3/envs/mujoco_py/lib -Wl,-rpath=/home/swagat/anaconda3/envs/mujoco_py/lib -Wl,--no-as-needed -Wl,--sysroot=/ /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxgpuextensionbuilder/temp.linux-x86_64-3.8/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/cymj.o /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxgpuextensionbuilder/temp.linux-x86_64-3.8/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/gl/eglshim.o -L/home/swagat/.mujoco/mujoco210/bin -R/home/swagat/.mujoco/mujoco210/bin -lmujoco210 -lglewegl -o /home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/generated/_pyxbld_2.1.2.14_38_linuxgpuextensionbuilder/lib.linux-x86_64-3.8/mujoco_py/cymj.cpython-38-x86_64-linux-gnu.so -fopenmp
gcc: error: unrecognized command line option ‘-R’
Traceback (most recent call last):
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/unixccompiler.py", line 204, in link
self.spawn(linker + ld_args)
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run, **kwargs)
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/spawn.py", line 87, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/__init__.py", line 2, in <module>
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/builder.py", line 504, in <module>
cymj = load_cython_ext(mujoco_path)
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/builder.py", line 110, in load_cython_ext
cext_so_path = builder.build()
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/builder.py", line 226, in build
built_so_file_path = self._build_impl()
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/builder.py", line 296, in _build_impl
so_file_path = super()._build_impl()
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/builder.py", line 249, in _build_impl
dist.run_commands()
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 341, in run
self.build_extensions()
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/mujoco_py-2.1.2.14-py3.8.egg/mujoco_py/builder.py", line 149, in build_extensions
build_ext.build_extensions(self)
File "/home/swagat/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 450, in build_extensions
self._build_extensions_serial()
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 475, in _build_extensions_serial
self.build_extension(ext)
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 552, in build_extension
self.compiler.link_shared_object(
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/ccompiler.py", line 713, in link_shared_object
self.link(CCompiler.SHARED_OBJECT, objects,
File "/home/swagat/.local/lib/python3.8/site-packages/setuptools/_distutils/unixccompiler.py", line 206, in link
raise LinkError(msg)
distutils.errors.LinkError: command '/usr/bin/gcc' failed with exit code 1
>>>
What packages do you have installed?
@wj210 I had the exact same issue. Solved it by upgrading to Mujoco 210 (found e.g here https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz) and reinstalling mujoco-py.
I can confirm that reinstalling Mujoco210 & compiling mujoco-py from source as suggested in this link solved the above problem. Thanks @rems75 for the suggestion.
I can confirm that reinstalling Mujoco210 & compiling mujoco-py from source as suggested in this link solved the above problem. Thanks @rems75 for the suggestion. I have installed it successfully,but Thanks all the same
I can confirm that reinstalling Mujoco210 & compiling mujoco-py from source as suggested in this link solved the above problem. Thanks @rems75 for the suggestion.
Following the steps in the link you suggested, fixed it for me. (I have Ubuntu, thus the conda steps were unnecessary and I omitted them). Thank you!
RUN pip3 install --user mujoco-py==2.0.2.8 before import mujoco_py
Upgrading to Mujoco 210 is not solving the issue for me, I am still getting the same error! :/ What should I do? I am on MacOS Catalina.
RUN pip3 install --user mujoco-py==2.0.2.8 before import mujoco_py
this command works for me. Ubuntu 20.04 with Mujoco 210
This error happened while i was trying to import mujoco_py in a docker file, i tried solutions for "x86_64-linux-gnu-gcc" error but it seems the cause of the error is different and the solution does not help. Here is the error log:
did anyone encountered similar error? its showing this weird logs such as "no such member"... that i do not understand.