Skip to content

Resolve the OpenGL backend lazily so import mujoco works without OpenGL libraries#3366

Open
kevinzakka wants to merge 1 commit into
google-deepmind:mainfrom
kevinzakka:defer-gl-backend-import
Open

Resolve the OpenGL backend lazily so import mujoco works without OpenGL libraries#3366
kevinzakka wants to merge 1 commit into
google-deepmind:mainfrom
kevinzakka:defer-gl-backend-import

Conversation

@kevinzakka

@kevinzakka kevinzakka commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

import mujoco currently fails on machines that don't have OpenGL installed, even if you never render anything. The reason is that mujoco loads the GL backend immediately at import time.

This PR makes it lazy: the backend loads only when you actually create a GLContext. So import mujoco works everywhere, and you get a clear error only if you try to render without OpenGL available.

Includes a test.

import mujoco no longer requires the OpenGL libraries when rendering is unused.
@yuvaltassa yuvaltassa requested a review from haroonq June 29, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant