Genesis-Embodied-AI/genesis-world · error · NotImplementedError
No display interface available for platform '{pyglet.compat_
Error message
No display interface available for platform '{pyglet.compat_platform}'. What it means
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.
Source
Thrown at genesis/utils/misc.py:583
screen_height : int | None
The height of the screen in pixels.
screen_width : int | None
The width of the screen in pixels.
screen_scale : float | None
The scale of the screen.
"""
# Resolve pyglet's native display backend directly, never the placeholder headless one whose finalizer calls
# eglTerminate on the EGL display the offscreen renderers share. A headless process then raises here, reported as
# no display - the fallback to a default size is the viewer's concern. Reuse a display pyglet already has open if
# any (the isinstance check skips a headless one).
native = {
"darwin": ("cocoa", "CocoaDisplay"),
"win32": ("win32", "Win32Display"),
"cygwin": ("win32", "Win32Display"),
"linux": ("xlib", "XlibDisplay"),
}.get(pyglet.compat_platform)
if native is None:
raise NotImplementedError(f"No display interface available for platform '{pyglet.compat_platform}'.")
# The backend submodule depends on the platform and pyglet version, and a foreign-platform one fails to import
# (e.g. 'win32' off Windows needs Windows-only ctypes), so it cannot be a top-level import; resolving it by
# computed name avoids a platform-by-version tree of local imports.
displays = pyglet.canvas if pyglet.version < "2.0" else pyglet.display
Display = getattr(import_module(f"{displays.__name__}.{native[0]}"), native[1])
display = next((d for d in displays._displays if isinstance(d, Display)), None)
if display is None:
display = Display()
screen = get_default_screen(display)
if pyglet.version < "2.0":
screen_scale = 1.0
else:
try:
screen_scale = screen.get_scale()
except NotImplementedError:
screen_scale = 1.0
return screen.height, screen.width, screen_scaleView on GitHub (pinned to 56e4aa5d82)
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.
Example fix
# before (on an unsupported platform) scene = gs.Scene(show_viewer=True) # __init__ -> has_display -> try_get_display_size raises # after scene = gs.Scene(show_viewer=False) # offscreen/headless: display query is skipped
Defensive patterns
Strategy: try-catch
Validate before calling
import pyglet
SUPPORTED = pyglet.compat_platform in {'darwin', 'win32', 'cygwin', 'linux'} Try / catch
try:
w, h = try_get_display_size()
except NotImplementedError:
w, h = 1920, 1080 # sensible headless default Prevention
- Default to headless (show_viewer=False) in containers and exotic platforms.
- Probe has_display()/platform support before building scenes with a viewer.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- pygel3d is not supported on Linux ARM (aarch64).
- Python module 'uipc' is required by IPCCoupler but is not in
- `morph` in hybrid entity should be either URDF or Mesh
- Cannot handle soft material {material_soft}
- Compounding joints of types 'FREE' or 'FIXED' with any other
AI-assisted analysis of Genesis-Embodied-AI/genesis-world@56e4aa5d82 (2026-08-28).
Data as JSON: /api/errors/a10191c2b9d5c220.
Report an issue: GitHub.