Skip to content

Mujoco-py is incompatible with cython 3 (Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil) #773

Open
@pseudo-rnd-thoughts

Description

@pseudo-rnd-thoughts

Describe the bug
Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'

To Reproduce
Install cpython 3.0.0, import mujoco-py

Expected behavior
mujoco-py compiles

Error Messages
From gymnasium's CI

tests/wrappers/test_passive_env_checker.py:9: in <module>
    from tests.envs.test_envs import PASSIVE_CHECK_IGNORE_WARNING
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
../lib/python3.8/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
    exec(co, module.__dict__)
tests/envs/test_envs.py:10: in <module>
    from tests.envs.utils import (
tests/envs/utils.py:34: in <module>
    all_testing_initialised_envs: List[Optional[gym.Env]] = [
tests/envs/utils.py:35: in <listcomp>
    try_make_env(env_spec) for env_spec in gym.envs.registry.values()
tests/envs/utils.py:22: in try_make_env
    return env_spec.make(disable_env_checker=True).unwrapped
gymnasium/envs/registration.py:130: in make
    return make(self, **kwargs)
gymnasium/envs/registration.py:756: in make
    env_creator = load_env_creator(env_spec.entry_point)
gymnasium/envs/registration.py:545: in load_env_creator
    mod = importlib.import_module(mod_name)
../lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
gymnasium/envs/mujoco/__init__.py:1: in <module>
    from gymnasium.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv  # isort:skip
gymnasium/envs/mujoco/mujoco_env.py:13: in <module>
    import mujoco_py
/mujoco-py/mujoco_py/__init__.py:2: in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
/mujoco-py/mujoco_py/builder.py:504: in <module>
    cymj = load_cython_ext(mujoco_path)
/mujoco-py/mujoco_py/builder.py:110: in load_cython_ext
    cext_so_path = builder.build()
/mujoco-py/mujoco_py/builder.py:226: in build
    built_so_file_path = self._build_impl()
/mujoco-py/mujoco_py/builder.py:278: in _build_impl
    so_file_path = super()._build_impl()
/mujoco-py/mujoco_py/builder.py:239: in _build_impl
    dist.ext_modules = cythonize([self.extension])
../lib/python3.8/site-packages/Cython/Build/Dependencies.py:1134: in cythonize
    cythonize_one(*args)
../lib/python3.8/site-packages/Cython/Build/Dependencies.py:1301: in cythonize_one
    raise CompileError(None, pyx_file)
E   Cython.Compiler.Errors.CompileError: /mujoco-py/mujoco_py/cymj.pyx
------------------------------- Captured stdout --------------------------------
Compiling /mujoco-py/mujoco_py/cymj.pyx because it changed.
[1/1] Cythonizing /mujoco-py/mujoco_py/cymj.pyx
------------------------------- Captured stderr --------------------------------

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/mujoco_py/cymj.pyx:92:23: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept 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/mujoco_py/cymj.pyx:127:21: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions