openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.81k stars 810 forks source link

CompileError: command 'gcc' failed with exit status 1 #738

Open newne opened 2 years ago

newne commented 2 years ago

Describe the bug I aleady install the mujoco : image

but when i install mujoco_py, some error happened and have no solution to solve it yet. i install with these command :

cd ~/mujoco-py
pip install -r requirements.txt
pip install -r requirements.dev.txt
python setup.py install

everything is ok ,but can not use it in python. it always came out this error. To Reproduce Steps to reproduce the behavior.

Expected behavior A clear and concise description of what you expected to happen.

Error Messages

(trajectory) ncg@ncg-pc:~/Downloads/mujoco-py$ ipython
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.3 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 

In [1]: import mujoco_py
running build_ext
building 'mujoco_py.cymj' extension
gcc -pthread -B /home/ncg/anaconda3/envs/trajectory/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Imujoco_py -I/home/ncg/Downloads/mujoco-py/mujoco_py -I/home/ncg/.mujoco/mujoco210/include -I/home/ncg/anaconda3/envs/trajectory/lib/python3.6/site-packages/numpy/core/include -I/home/ncg/Downloads/mujoco-py/mujoco_py/vendor/egl -I/home/ncg/anaconda3/envs/trajectory/include/python3.6m -c /home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c -o /home/ncg/Downloads/mujoco-py/mujoco_py/generated/_pyxbld_2.1.2.14_36_linuxgpuextensionbuilder/temp.linux-x86_64-3.6/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.o -fopenmp -w
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c: In function ‘__pyx_f_9mujoco_py_4cymj_8PyMjData__set’:
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c:61635:78: error: ‘mjData’ {aka ‘struct mjData_’} has no member named ‘qfrc_unc’
61635 |   __pyx_t_4 = ((PyObject *)__pyx_f_9mujoco_py_4cymj__wrap_mjtNum_1d(__pyx_v_p->qfrc_unc, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 2943, __pyx_L1_error)
      |                                                                              ^~
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c:61654:78: error: ‘mjData’ {aka ‘struct mjData_’} has no member named ‘qacc_unc’
61654 |   __pyx_t_4 = ((PyObject *)__pyx_f_9mujoco_py_4cymj__wrap_mjtNum_1d(__pyx_v_p->qacc_unc, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 2944, __pyx_L1_error)
      |                                                                              ^~
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c: In function ‘__pyx_pf_9mujoco_py_4cymj_12PyMjrContext_15glewInitialized___get__’:
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c:84600:55: error: ‘mjrContext’ {aka ‘struct mjrContext_’} has no member named ‘glewInitialized’; did you mean ‘glInitialized’?
84600 |   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->ptr->glewInitialized); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4175, __pyx_L1_error)
      |                                                       ^~~~~~~~~~~~~~~
      |                                                       glInitialized
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c: In function ‘__pyx_pf_9mujoco_py_4cymj_12PyMjrContext_15glewInitialized_2__set__’:
/home/ncg/Downloads/mujoco-py/mujoco_py/cymj.c:84655:22: error: ‘mjrContext’ {aka ‘struct mjrContext_’} has no member named ‘glewInitialized’; did you mean ‘glInitialized’?
84655 |   __pyx_v_self->ptr->glewInitialized = __pyx_v_x;
      |                      ^~~~~~~~~~~~~~~
      |                      glInitialized
---------------------------------------------------------------------------
DistutilsExecError                        Traceback (most recent call last)
~/anaconda3/envs/trajectory/lib/python3.6/distutils/unixccompiler.py in _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
    117             self.spawn(compiler_so + cc_args + [src, '-o', obj] +
--> 118                        extra_postargs)
    119         except DistutilsExecError as msg:

~/anaconda3/envs/trajectory/lib/python3.6/distutils/ccompiler.py in spawn(self, cmd)
    908     def spawn(self, cmd):
--> 909         spawn(cmd, dry_run=self.dry_run)
    910 

~/anaconda3/envs/trajectory/lib/python3.6/distutils/spawn.py in spawn(cmd, search_path, verbose, dry_run)
     35     if os.name == 'posix':
---> 36         _spawn_posix(cmd, search_path, dry_run=dry_run)
     37     elif os.name == 'nt':

~/anaconda3/envs/trajectory/lib/python3.6/distutils/spawn.py in _spawn_posix(cmd, search_path, verbose, dry_run)
    158                           "command %r failed with exit status %d"
--> 159                           % (cmd, exit_status))
    160             elif os.WIFSTOPPED(status):

DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

CompileError                              Traceback (most recent call last)
<ipython-input-1-85c6ae7fd0aa> in <module>
----> 1 import mujoco_py

~/Downloads/mujoco-py/mujoco_py/__init__.py in <module>
      1 #!/usr/bin/env python
----> 2 from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
      3 from mujoco_py.generated import const
      4 from mujoco_py.mjrenderpool import MjRenderPool
      5 from mujoco_py.mjviewer import MjViewer, MjViewerBasic

~/Downloads/mujoco-py/mujoco_py/builder.py in <module>
    502 
    503 mujoco_path = discover_mujoco()
--> 504 cymj = load_cython_ext(mujoco_path)
    505 
    506 

~/Downloads/mujoco-py/mujoco_py/builder.py in load_cython_ext(mujoco_path)
    108                 print("Import error. Trying to rebuild mujoco_py.")
    109         if mod is None:
--> 110             cext_so_path = builder.build()
    111             mod = load_dynamic_ext('cymj', cext_so_path)
    112 

~/Downloads/mujoco-py/mujoco_py/builder.py in build(self)
    224 
    225     def build(self):
--> 226         built_so_file_path = self._build_impl()
    227         new_so_file_path = self.get_so_file_path()
    228         move(built_so_file_path, new_so_file_path)

~/Downloads/mujoco-py/mujoco_py/builder.py in _build_impl(self)
    294 
    295     def _build_impl(self):
--> 296         so_file_path = super()._build_impl()
    297         fix_shared_library(so_file_path, 'libOpenGL.so', 'libOpenGL.so.0')
    298         fix_shared_library(so_file_path, 'libEGL.so', 'libEGL.so.1')

~/Downloads/mujoco-py/mujoco_py/builder.py in _build_impl(self)
    247         dist.parse_command_line()
    248         obj_build_ext = dist.get_command_obj("build_ext")
--> 249         dist.run_commands()
    250         built_so_file_path, = obj_build_ext.get_outputs()
    251         return built_so_file_path

~/anaconda3/envs/trajectory/lib/python3.6/distutils/dist.py in run_commands(self)
    953         """
    954         for cmd in self.commands:
--> 955             self.run_command(cmd)
    956 
    957     # -- Methods that operate on its Commands --------------------------

~/anaconda3/envs/trajectory/lib/python3.6/distutils/dist.py in run_command(self, command)
    972         cmd_obj = self.get_command_obj(command)
    973         cmd_obj.ensure_finalized()
--> 974         cmd_obj.run()
    975         self.have_run[command] = 1
    976 

~/anaconda3/envs/trajectory/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py in run(self)
    184             optimization.disable_optimization()
    185 
--> 186         _build_ext.build_ext.run(self)
    187 
    188     def build_extensions(self):

~/anaconda3/envs/trajectory/lib/python3.6/distutils/command/build_ext.py in run(self)
    337 
    338         # Now actually compile and link everything.
--> 339         self.build_extensions()
    340 
    341     def check_extensions_list(self, extensions):

~/Downloads/mujoco-py/mujoco_py/builder.py in build_extensions(self)
    147         except (AttributeError, ValueError):
    148             pass
--> 149         build_ext.build_extensions(self)
    150 
    151 

~/anaconda3/envs/trajectory/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py in build_extensions(self)
    193             ext.sources = self.cython_sources(ext.sources, ext)
    194         # Call original build_extensions
--> 195         _build_ext.build_ext.build_extensions(self)
    196 
    197     def cython_sources(self, sources, extension):

~/anaconda3/envs/trajectory/lib/python3.6/distutils/command/build_ext.py in build_extensions(self)
    446             self._build_extensions_parallel()
    447         else:
--> 448             self._build_extensions_serial()
    449 
    450     def _build_extensions_parallel(self):

~/anaconda3/envs/trajectory/lib/python3.6/distutils/command/build_ext.py in _build_extensions_serial(self)
    471         for ext in self.extensions:
    472             with self._filter_build_errors(ext):
--> 473                 self.build_extension(ext)
    474 
    475     @contextlib.contextmanager

~/anaconda3/envs/trajectory/lib/python3.6/distutils/command/build_ext.py in build_extension(self, ext)
    531                                          debug=self.debug,
    532                                          extra_postargs=extra_args,
--> 533                                          depends=ext.depends)
    534 
    535         # XXX outdated variable, kept here in case third-part code

~/anaconda3/envs/trajectory/lib/python3.6/distutils/ccompiler.py in compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends)
    572             except KeyError:
    573                 continue
--> 574             self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    575 
    576         # Return *all* object filenames, not just the ones we just built.

~/anaconda3/envs/trajectory/lib/python3.6/distutils/unixccompiler.py in _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
    118                        extra_postargs)
    119         except DistutilsExecError as msg:
--> 120             raise CompileError(msg)
    121 
    122     def create_static_lib(self, objects, output_libname,

CompileError: command 'gcc' failed with exit status 1

Desktop (please complete the following information):

Environment

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ncg/.mujoco/mujoco210/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ncg/.mujoco/mujoco210/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ncg/.mujoco/mujoco210/include/mujoco:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ncg/.mujoco/mujoco210/include:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ncg/.mujoco/mujoco210/bin
# cuda
export PATH=/usr/local/cuda-11.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64:$LD_LIBRARY_PATH

Additional context Add any other context about the problem here.

CT702-7 commented 1 year ago

Same problem as I met, but that was just one of wired problems...

saran-t commented 1 year ago

If you're looking start using MuJoCo in a new project, please use https://github.com/deepmind/mujoco (aka pip install mujoco) instead.

mujoco-py is no longer being developed or maintained.

CT702-7 commented 1 year ago

After experiencing a verbose installing procedure, the problem is settled at last. It is hard to say what I have experienced when I installed majoco-py, the process really drag me crazy. But it worked when I have added a bundle of packages into my ubuntu and reboot the system. Thank you for your contribution to this open source project and your reply anyway. I will inform my mates as well.

------------------ 原始邮件 ------------------ 发件人: "openai/mujoco-py" @.>; 发送时间: 2022年9月5日(星期一) 晚上9:03 @.>; @.**@.>; 主题: Re: [openai/mujoco-py] CompileError: command 'gcc' failed with exit status 1 (Issue #738)

If you're looking start using MuJoCo in a new project, please use https://github.com/deepmind/mujoco (aka pip install mujoco) instead.

mujoco-py is no longer being developed or maintained.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>