环境
Ubuntu20.04,dm-control,mujoco_py,单个显卡
遇到了问题:
DRI2: failed to create dri screen
ImportError: Cannot initialize a EGL device display. This likely means that your EGL driver does not support the PLATFORM_DEVICE extension, which is required for creating a headless rendering context.
原因
造成 ImportError: Cannot initialize a headless EGL display 错误的原因可能有以下几种:
1. EGL Display 初始化失败
create_initialized_headless_egl_display 函数未能成功初始化 EGL display,返回了 EGL.EGL_NO_DISPLAY。
2. 设备不可用
eglQueryDevicesEXT 返回的设备列表中没有可用的设备,或者环境变量 MUJOCO_EGL_DEVICE_ID 指定了一个无效的设备 ID。
3. EGL 初始化失败
即使 eglGetPlatformDisplayEXT 成功返回了一个 display,eglInitialize 可能会失败,导致无法初始化 EGL display。
4. 环境变量设置错误
PYOPENGL_PLATFORM 环境变量未设置为 EGL 或者设置了不正确的值。
这个错误表明EGL驱动程序不支持PLATFORM_DEVICE
扩展,这是创建无头渲染上