PKU-Alignment / safety-gymnasium

NeurIPS 2023: Safety-Gymnasium: A Unified Safe Reinforcement Learning Benchmark
https://safety-gymnasium.readthedocs.io/en/latest/
Apache License 2.0
385 stars 53 forks source link

[Question] render error #123

Open mumuyanyan opened 2 weeks ago

mumuyanyan commented 2 weeks ago

Required prerequisites

Questions

My code is


import safety_gymnasium

env_id = 'SafetyPointGoal1-v0'
render_mode = "human" if True else None
env = safety_gymnasium.make(env_id,
                            render_mode=render_mode)
obs, info = env.reset()
while True:
    act = env.action_space.sample()
    obs, reward, cost, terminated, truncated, info = env.step(act)
    if terminated or truncated:
        break
    env.render()

The error is

warning: queue 0x2123a10 destroyed while proxies still attached:
  wl_registry#21 still attached
WARNING: OpenGL error 0x502 in or before mjr_makeContext

[destroyed object]: error 7: failed to import supplied dmabufs: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a 
warning: queue 0x23aa930 destroyed while proxies still attached:
  wl_callback#43 still attached
warning: queue 0x2123d30 destroyed while proxies still attached:
  zwp_linux_dmabuf_v1#23 still attached
/home/xx/anaconda3/envs/safe/lib/python3.8/site-packages/glfw/__init__.py:914: GLFWError: (65537) b'The GLFW library is not initialized'
  warnings.warn(message, GLFWError)
Exception ignored in: <function WindowViewer.__del__ at 0x780a67fbe940>
Traceback (most recent call last):
  File "/home/xx/anaconda3/envs/safe/lib/python3.8/site-packages/gymnasium/envs/mujoco/mujoco_rendering.py", line 335, in __del__
  File "/home/xx/anaconda3/envs/safe/lib/python3.8/site-packages/gymnasium/envs/mujoco/mujoco_rendering.py", line 328, in free
AttributeError: 'NoneType' object has no attribute 'get_current_context'
muchvo commented 3 days ago

Sorry for the late response. It seems I missed this issue. It looks like you encountered this error when exiting the render process? This issue is inherited from Gymnasium, and I’ve had discussions with its developers about it. Unfortunately, resolving this problem is quite challenging, but it shouldn’t affect normal usage. If you need further assistance, feel free to reach out to me.