Skip to content

Jupyter notebook Kernel Died #83

@Yixun-Hu

Description

@Yixun-Hu

Kernel crashes (process dies) when calling env.render() in VLABench (dm_control / MuJoCo OpenGL context)

System / environment

  • OS: Linux x86_64 (kernel 6.14.0-37-generic, glibc 2.39)
  • Python: 3.10.19 (conda env)
  • pip: 26.0.1
  • VSCode: 1.108.2
    • Jupyter extension: 2025.9.1
    • Python extension: 2026.0.0
  • Key packages:
    • dm_control==1.0.22
    • mujoco==3.2.2, mujoco-mjx==3.2.2
    • numpy==1.25.0
    • opencv-python-headless (cv2 version 4.13.0)

What I’m trying to do

Render an RGB image from a VLABench environment inside a Jupyter notebook.

Steps to reproduce

import os
from PIL import Image
from VLABench.envs import load_env

task = "select_fruit"
robot = "franka"

env = load_env(task, robot=robot, time_limit=1000)
env.reset()

image = env.render(camera_id=2, width=640, height=640)
Image.fromarray(image)

Expected behavior

env.render(...) returns a (H, W, 3) uint8 numpy array and the notebook continues running.

Actual behavior

The Jupyter kernel crashes / dies when executing env.render(...) (VSCode shows “The kernel crashed…”).
VSCode Jupyter log repeatedly shows:

Disposing session as kernel process died ExitCode: undefined

In earlier attempts (before the kernel started dying), I also observed:

FatalError: gladLoadGL error from dm_control.mujoco.engine.Physics.render(...)

Additionally, importing the dm_control viewer triggers an X11 warning:

GLFWError: (65550) b'X11: The DISPLAY environment variable is missing'

This machine is headless (no X11 display).

Debug info

In the current environment:

cv2.dilate exists (hasattr(cv2, "dilate") == True)

MUJOCO_GL and PYOPENGL_PLATFORM are not set at the process level:

MUJOCO_GL=None

PYOPENGL_PLATFORM=None

What I tried

Reinstalled OpenCV / switched to opencv-python-headless to avoid GUI dependencies.

Restarted the kernel / reran the notebook.

(Earlier) tried setting os.environ["MUJOCO_GL"]="egl" inside the notebook, but I may have set it after some imports.

Question

Is there a recommended / supported way to run VLABench rendering on a headless machine (e.g., EGL or OSMesa), and should VLABench enforce or document MUJOCO_GL / PYOPENGL_PLATFORM settings before importing dm_control / mujoco?

If useful, I can provide:

Full VSCode Jupyter output logs

pip freeze

GPU / driver info (nvidia-smi)

Why this likely happens (optional note you can keep or delete): MuJoCo rendering needs an OpenGL backend; on headless machines the default GLFW/X11 path often fails, and you typically need to force MUJOCO_GL=egl (GPU headless) or MUJOCO_GL=osmesa (CPU headless). :contentReference[oaicite:0]{index=0}
::contentReference[oaicite:1]{index=1}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions