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.79k stars 810 forks source link

after installing mujoco_py I get this cython error #785

Closed davidireland3 closed 5 months ago

davidireland3 commented 5 months ago

I'm installing on Linux and get as far as being able to import mujoco_py in python until I get the following error each time. Does anyone know what is causing this?

Compiling /home/USER/.mujoco/mujoco-py/mujoco_py/cymj.pyx because it changed.
[1/1] Cythonizing /home/USER/.mujoco/mujoco-py/mujoco_py/cymj.pyx
performance hint: /home/USER/.mujoco/mujoco-py/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: /home/USER/.mujoco/mujoco-py/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
                       ^
------------------------------------------------------------
Wcy0802 commented 5 months ago

i have same issue, wait someone can solve

akrv commented 5 months ago

I downgraded the Cython version pip install cython<3.0 that fixed this error. but I have other errors now.

whosthereme commented 5 months ago

anyone fixed it? i have same issue. i tried the solution they provided but never work.

whosthereme commented 5 months ago

ehh. try my solution:

  1. pip install Cython==0.29.37
  2. sudo apt-get install libglew-dev

if it works. say xiexie.