{"record":{"id":"a10191c2b9d5c220","repo":"Genesis-Embodied-AI/genesis-world","slug":"no-display-interface-available-for-platform-pygl","errorCode":null,"errorMessage":"No display interface available for platform '{pyglet.compat_platform}'.","messagePattern":"No display interface available for platform '(.+?)'\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"genesis/utils/misc.py","lineNumber":583,"sourceCode":"    screen_height : int | None\n        The height of the screen in pixels.\n    screen_width : int | None\n        The width of the screen in pixels.\n    screen_scale : float | None\n        The scale of the screen.\n    \"\"\"\n    # Resolve pyglet's native display backend directly, never the placeholder headless one whose finalizer calls\n    # eglTerminate on the EGL display the offscreen renderers share. A headless process then raises here, reported as\n    # no display - the fallback to a default size is the viewer's concern. Reuse a display pyglet already has open if\n    # any (the isinstance check skips a headless one).\n    native = {\n        \"darwin\": (\"cocoa\", \"CocoaDisplay\"),\n        \"win32\": (\"win32\", \"Win32Display\"),\n        \"cygwin\": (\"win32\", \"Win32Display\"),\n        \"linux\": (\"xlib\", \"XlibDisplay\"),\n    }.get(pyglet.compat_platform)\n    if native is None:\n        raise NotImplementedError(f\"No display interface available for platform '{pyglet.compat_platform}'.\")\n    # The backend submodule depends on the platform and pyglet version, and a foreign-platform one fails to import\n    # (e.g. 'win32' off Windows needs Windows-only ctypes), so it cannot be a top-level import; resolving it by\n    # computed name avoids a platform-by-version tree of local imports.\n    displays = pyglet.canvas if pyglet.version < \"2.0\" else pyglet.display\n    Display = getattr(import_module(f\"{displays.__name__}.{native[0]}\"), native[1])\n    display = next((d for d in displays._displays if isinstance(d, Display)), None)\n    if display is None:\n        display = Display()\n\n    screen = get_default_screen(display)\n    if pyglet.version < \"2.0\":\n        screen_scale = 1.0\n    else:\n        try:\n            screen_scale = screen.get_scale()\n        except NotImplementedError:\n            screen_scale = 1.0\n    return screen.height, screen.width, screen_scale","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/Genesis-Embodied-AI/genesis-world/blob/56e4aa5d82bdb83f2e532e4cc364cb69527acb06/genesis/utils/misc.py#L565-L601","documentation":"try_get_display_size resolves the platform-native pyglet Display class to query the screen resolution; pyglet only ships display backends for cocoa (macOS), win32 (Windows) and xlib (Linux/X11). If pyglet.compat_platform maps to none of these (e.g. freebsd, sunos, or an unknown platform string), the lookup dict returns None and a NotImplementedError is raised naming the platform. This is a hard capability gap: no display querying is possible for that platform, so has_display and the caller in __init__ fail too.","triggerScenarios":"Running Genesis with rendering/viewer initialization on a platform outside {darwin, win32, cygwin, linux}: e.g. FreeBSD, or a Linux variant where pyglet.compat_platform reports something unexpected. Also triggered indirectly through has_display() / visualizer __init__ on those platforms.","commonSituations":"Attempting to use the viewer or any display-size-dependent default (e.g. window resolution) on BSD or an exotic container; users on Wayland-only systems usually still report 'linux' (xlib via XWayland) and are unaffected, so genuinely hitting this usually means an unusual OS.","solutions":["Run on a supported platform (Linux with X11/XWayland, macOS, or Windows).","Set a headless/offscreen rendering path (no viewer) so try_get_display_size is never called.","On FreeBSD, try setting an env shim so pyglet.compat_platform resolves to 'linux' (compatibility is at your own risk), or patch the mapping dict to include xlib for your platform string."],"exampleFix":"# before (on an unsupported platform)\nscene = gs.Scene(show_viewer=True)  # __init__ -> has_display -> try_get_display_size raises\n# after\nscene = gs.Scene(show_viewer=False)  # offscreen/headless: display query is skipped","handlingStrategy":"try-catch","validationCode":"import pyglet\nSUPPORTED = pyglet.compat_platform in {'darwin', 'win32', 'cygwin', 'linux'}","typeGuard":null,"tryCatchPattern":"try:\n    w, h = try_get_display_size()\nexcept NotImplementedError:\n    w, h = 1920, 1080  # sensible headless default","preventionTips":["Default to headless (show_viewer=False) in containers and exotic platforms.","Probe has_display()/platform support before building scenes with a viewer."],"tags":["genesis","pyglet","platform-support","display","viewer","headless"],"backgroundTag":"unsupported-platform-architecture","analyzedSha":"56e4aa5d82bdb83f2e532e4cc364cb69527acb06","analyzedAt":"2026-08-28T15:15:07.922Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}