Running on AWS EC2 #2438
Replies: 1 comment
-
This appears like an issue with using MjrContext on a headless machine, and nothing specific to EC2. Since headless rendering works on the tutorial colab, and the mujoco.Renderer wrapper successfully creates a context internally, I was able to get my code to work by copying the code from mujoco.Renderer: from mujoco import _enums This works on the colab. |
Beta Was this translation helpful? Give feedback.
-
Intro
Hi!
I'm a professor at Technion.
Use Mujoco for robot learning.
My setup
Mujoco 3.2.7
Python
EC2 instance type: g4dn.2xlarge
AMI: Deep Learning OSS Nvidia Driver AMI GPU PyTorch 2.5.1 (Ubuntu 22.04) 20250216
My question
I am trying to run Mujoco on an AWS EC2 instance with GPU and have issues with headless rendering.
I have tried both EGL and OSMesa but get the same error when running mj.MjrContext:
mujoco.FatalError: gladLoadGL error
Would really be grateful if anyone managed to run mujoco headless on EC2 and can share how.
Minimal model and/or code that explain my question
Here's a failure case with Osmesa. I get the same error if I change osmesa to egl.
import os
os.environ["MUJOCO_GL"] = "osmesa" # Use OSMesa for headless rendering
os.environ["PYOPENGL_PLATFORM"] = "osmesa" # Force PyOpenGL to use OSMesa
import mujoco as mj
minimal_xml = """
"""model = mj.MjModel.from_xml_string(minimal_xml)
context = mj.MjrContext(model, mj.mjtFontScale.mjFONTSCALE_100.value)
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions