younggyoseo / MWM

Masked World Models for Visual Control
Other
114 stars 9 forks source link

mujoco-py problems #5

Open zichunxx opened 6 months ago

zichunxx commented 6 months ago

Hi! Thanks for your nice work.

I tried to install the dependencies following the README and created a conda env with python==3.8.

However, I met the following installation problems

Building wheels for collected packages: mujoco-py
  Building wheel for mujoco-py (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mujoco-py (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [95 lines of output]
      running bdist_wheel
      running build
      performance hint: mujoco_py/cymj.pyx:67:5: Exception check on 'c_warning_callback' will always require the GIL to be acquired.
      Possible solutions:
          1. Declare 'c_warning_callback' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
          2. Use an 'int' return type on 'c_warning_callback' to allow an error code to be returned.
      performance hint: mujoco_py/cymj.pyx:104:5: Exception check on 'c_error_callback' will always require the GIL to be acquired.
      Possible solutions:
          1. Declare 'c_error_callback' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
          2. Use an 'int' return type on 'c_error_callback' to allow an error code to be returned.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          See c_warning_callback, which is the C wrapper to the user defined function
          '''
          global py_warning_callback
          global mju_user_warning
          py_warning_callback = warn
          mju_user_warning = c_warning_callback
                             ^
      ------------------------------------------------------------

      mujoco_py/cymj.pyx:92:23: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          See c_warning_callback, which is the C wrapper to the user defined function
          '''
          global py_error_callback
          global mju_user_error
          py_error_callback = err_callback
          mju_user_error = c_error_callback
                           ^
      ------------------------------------------------------------

      mujoco_py/cymj.pyx:127:21: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
      Removing old mujoco_py cext /tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/generated/cymj_2.0.2.13_38_linuxcpuextensionbuilder_38.so
      Compiling /tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/cymj.pyx because it changed.
      [1/1] Cythonizing /tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/cymj.pyx
      Traceback (most recent call last):
        File "/home/xzc/mambaforge/envs/MWM/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/xzc/mambaforge/envs/MWM/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/xzc/mambaforge/envs/MWM/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 33, in <module>
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-rbf3x8vr/normal/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 29, in run
        File "/tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/__init__.py", line 3, in <module>
          from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
        File "/tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/builder.py", line 510, in <module>
          cymj = load_cython_ext(mujoco_path)
        File "/tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/builder.py", line 105, in load_cython_ext
          cext_so_path = builder.build()
        File "/tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/builder.py", line 221, in build
          built_so_file_path = self._build_impl()
        File "/tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/builder.py", line 273, in _build_impl
          so_file_path = super()._build_impl()
        File "/tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/builder.py", line 234, in _build_impl
          dist.ext_modules = cythonize([self.extension])
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-rbf3x8vr/overlay/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: /tmp/pip-install-w_sl8xrs/mujoco-py_cd8a7990514e464ab01fc96c58a9dd13/mujoco_py/cymj.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mujoco-py
Failed to build mujoco-py
ERROR: Could not build wheels for mujoco-py, which is required to install pyproject.toml-based projects

Would you mind giving more specific instructions about your python env? Thanks in advance.

DJ-Won commented 4 months ago

Hi! zichunxx, have you overcame this yet? I also encountered this error with python3.8 under ubuntu20.08. By using: pip install cython==3.0.0a10 the problem might solve.

zichunxx commented 4 months ago

Hi, @DJ-Won! Thanks for your kind help! I will try with your solution.