Skip to content

render.py cannot run headless: NoSuchDisplayException without an X display #36

Description

@Nitjsefnie

Description

On a display-less machine (typical CI box or server), rendering fails with pyglet's NoSuchDisplayExceptionrender.py's pyrender usage defaults to the GL platform that needs an X display, so there is no way to produce renders headless.

Reproduced on a Linux server with no X (originally hit during the Open3D-vs-pyrender evaluation for #10, where it was noted in the eval document; filing it as its own issue so it's trackable).

Suggested direction

pyrender supports headless operation via PYOPENGL_PLATFORM=egl (GPU) or PYOPENGL_PLATFORM=osmesa (pure software). Options, roughly in order of usefulness:

  1. Honor an existing PYOPENGL_PLATFORM env var (set nothing when unset — zero behavior change on desktops), and document headless usage in the README.
  2. Or add a --headless flag that sets osmesa before the pyrender import.

The import-order footnote matters: the env var must be set before pyrender/pyglet are first imported, so the flag/env handling has to run at entrypoint top, not inside the render call.

Happy to submit a PR — with the caveat that this box can verify the osmesa path only if the software-GL dependencies install cleanly; the PR would state exactly which paths were executed.

Filed with AI assistance (Claude); the exception was reproduced on a real headless machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions