Skip to content

Fixing MuJoCo, LeRobot and CUDA Install Errors: 14 Error Messages, Their Causes and Fixes (WSL2 and Apple Silicon Included)

Source-verified fixes for 14 MuJoCo, LeRobot and CUDA errors: silent LeRobot 0.4.4 installs, old drivers, libtorchcodec, EGL displays, mjpython and MPS ops.

Contents

Key takeaways

  1. On Python 3.10 or 3.11, an unpinned pip install lerobot succeeds without any error and installs 0.4.4, the last release with Requires-Python >=3.10, so check the installed version right after installing.
  2. ‘The NVIDIA driver on your system is too old’ does not mean a broken GPU: the torch wheel targets a newer CUDA than the driver supports. The Linux PyPI default wheel (cu130) needs driver 580.65+, the cu128 index needs 570.86+.
  3. On WSL2, NVIDIA’s rule is to install only the Windows NVIDIA driver and never a Linux display driver or the cuda-drivers meta-package inside WSL.
  4. ‘Could not load libtorchcodec’ comes down to a missing FFmpeg (supported major versions 4 to 9) or a torch/torchcodec mismatch; LeRobot 0.6.1 constrains torch<2.12 and torchcodec<0.12.
  5. On Apple Silicon, check three things in order: an arm64 Python, the viewer launched with mjpython, and PYTORCH_ENABLE_MPS_FALLBACK=1 when an op has no MPS kernel.

When a MuJoCo plus LeRobot install breaks, the same symptom can come from the Python version, the torch build, the NVIDIA driver or the rendering backend. This article walks through 14 error messages that actually exist in the official docs and source code of these packages, and gives the cause and the order in which to try fixes. Choosing a version combination from scratch is covered in the MuJoCo and LeRobot install version guide; this page is only for the moment after an install has already failed.

The error strings were checked on October 31, 2026 against the main branches of the MuJoCo, PyTorch, TorchCodec and pip repositories. Your installed version may word things slightly differently, so search this page by the key phrase rather than the exact sentence.

A ten-second triage: which layer is failing?

Before reading individual errors, print the Python, torch and rendering configuration in one go. The output usually tells you which section to jump to.

python - <<'EOF'
import os, sys, platform
print("python  :", sys.version.split()[0], platform.machine())
for env in ("MUJOCO_GL", "PYOPENGL_PLATFORM", "MUJOCO_EGL_DEVICE_ID", "CUDA_VISIBLE_DEVICES"):
    print(f"{env:20}:", os.environ.get(env))
try:
    import torch
    print("torch   :", torch.__version__, "cuda build:", torch.version.cuda)
    print("cuda ok :", torch.cuda.is_available(), "arch:", torch.cuda.get_arch_list())
    print("mps ok  :", torch.backends.mps.is_available(), "built:", torch.backends.mps.is_built())
except Exception as e:
    print("torch import failed:", e)
from importlib.metadata import version, PackageNotFoundError
for pkg in ("lerobot", "mujoco", "torchcodec", "av"):
    try:
        print(f"{pkg:8}:", version(pkg))
    except PackageNotFoundError:
        print(f"{pkg:8}: not installed")
EOF
Triage outputLayer to suspectSection
lerobot shows 0.4.xPython version1
cuda build is set but cuda ok is FalseDriver or GPU architecture2 to 5
cuda build is NoneCPU-only torch5
Only video dataset loading failsFFmpeg, TorchCodec, PyAV6 and 7
Only rendering or the viewer failsMuJoCo GL backend8 to 12
Import or training fails on a MacArchitecture, MPS13 and 14

Errors 1 to 5: Python version, torch build and NVIDIA driver

1. pip installs LeRobot 0.4.4 without complaining

This is the hardest one to notice because nothing fails. The PyPI release history shows Requires-Python >=3.10 up to 0.4.4 (2026-02-27) and >=3.12 from 0.5.0 onward. On Python 3.10 or 3.11, an unpinned install therefore resolves to 0.4.4, the newest release your interpreter is allowed to use, and pip reports success. Only when you pin a version does the pip resolver spell out the problem:

ERROR: Ignored the following versions that require a different python version: ...
ERROR: Could not find a version that satisfies the requirement lerobot==0.6.1 (from versions: ...)
ERROR: No matching distribution found for lerobot==0.6.1

The fix is a fresh Python 3.12 environment. Upgrading Python inside an existing environment tends to leave compiled wheels in an inconsistent state, so deleting and recreating the environment is the more reliable route.

conda create -y -n lerobot python=3.12 && conda activate lerobot
pip install 'lerobot[training]==0.6.1'
pip show lerobot | grep Version

2. The NVIDIA driver on your system is too old

PyTorch’s CUDAFunctions.cpp raises this message when the CUDA runtime reports an insufficient driver (cudaErrorInsufficientDriver). It often appears as a warning at the same time torch.cuda.is_available() returns False.

The NVIDIA driver on your system is too old (found version 12040). Please update your GPU driver ...

The number in parentheses is the CUDA version your driver supports (the value above is only an example). The cause is a torch wheel built for a newer CUDA than that. According to the LeRobot installation docs, the default PyPI torch wheel on Linux bundles CUDA 13.0 with a driver floor of 580.65, while the cu128 index has a floor of 570.86. If you cannot upgrade the driver, reinstall torch from a lower CUDA index:

nvidia-smi --query-gpu=driver_version --format=csv,noheader
pip install --force-reinstall --index-url https://download.pytorch.org/whl/cu128 torch torchvision

LeRobot 0.6.1 declares torch>=2.7,<2.12 and torchvision>=0.22,<0.27, so run pip check afterwards to confirm nothing outside that range slipped in.

3. Found no NVIDIA driver on your system (especially on WSL2)

The same source file prints Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver ... when no driver is visible at all. On native Linux that is simply a missing driver. On WSL2 the model is different: the NVIDIA CUDA on WSL guide explains that the Windows driver is stubbed inside WSL 2 as libcuda.so and says plainly not to install any Linux display driver in WSL.

  1. Confirm the Windows host runs an NVIDIA driver from R495 onward, on a Pascal-or-later GPU, with a WSL kernel of at least 4.19.121.
  2. Inside WSL, run /usr/lib/wsl/lib/nvidia-smi to check that the GPU is visible, and add /usr/lib/wsl/lib/ to PATH if needed.
  3. If you need the CUDA toolkit, install only cuda-toolkit-12-x from the WSL-Ubuntu package and avoid the cuda, cuda-12-x and cuda-drivers meta-packages. If you only need torch, skip the toolkit entirely, since the torch wheel ships its own CUDA runtime.

The same guide’s known-limitations list notes that pinned system memory is limited, which can break some deep learning training workloads, and that OpenGL-CUDA interop is not supported. If training on WSL2 dies with memory-related errors, or MuJoCo GPU rendering will not start, suspect those limits first; for rendering, fall back to MUJOCO_GL=osmesa or a native Windows install. The LeRobot docs also ask you to add conda install evdev -c conda-forge when installing inside WSL.

4. sm_XX is not compatible with the current PyTorch installation

torch/cuda/__init__.py issues this warning when your GPU’s compute capability is missing from the architecture list of the installed build:

NVIDIA ... with CUDA capability sm_XX is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_...

Here the driver is fine but the torch build contains no kernels for your GPU generation. Compare the arch list from the triage script with your card. The LeRobot docs state that cu128 covers Ampere, Ada, Hopper and Blackwell, and that cu130 is an option for Blackwell on driver 580 or newer.

5. AssertionError: Torch not compiled with CUDA enabled

If torch.version.cuda is None, you have a CPU-only torch. This can happen after a correct CUDA install if a later package install swaps torch for a CPU wheel. Reinstall from the CUDA index with the --force-reinstall command in section 2, and order your installs so nothing touches torch afterwards.

Errors 6 and 7: video decoding with FFmpeg, TorchCodec and PyAV

6. Could not load libtorchcodec

When its shared-library loader fails, TorchCodec lists the likely causes itself:

RuntimeError: Could not load libtorchcodec. Likely causes:
  1. FFmpeg is not properly installed in your environment. We support
     versions 4, 5, 6, 7, 8, and 9 ...
  2. The PyTorch version (...) is not compatible with
     this version of TorchCodec. ...
  3. Another runtime dependency; see exceptions below.

The compatibility table in the TorchCodec README pairs torchcodec 0.10 with torch 2.10 and 0.11 with torch 2.11. On Linux x86_64 and Apple Silicon, LeRobot 0.6.1 requires torchcodec>=0.3.0,<0.12.0, so a separately installed torch 2.12 or newer breaks the pairing. Work through it in this order:

  1. Run ffmpeg -version and check that FFmpeg exists and its major version is between 4 and 9.
  2. If it is missing or out of range, install it with conda install ffmpeg -c conda-forge. The LeRobot docs suggest pinning conda install ffmpeg=7.1.1 -c conda-forge if libsvtav1 is missing or the version clashes with torchcodec.
  3. A system FFmpeg from apt or brew is only supported with PyTorch 2.10 or newer (TorchCodec 0.10 or newer); with older torch, use the conda-forge build.
  4. On Windows, use a “full-shared” FFmpeg build that ships the DLLs.

On platforms where TorchCodec is unavailable (Intel Macs, Linux ARM, Windows with PyTorch below 2.8), LeRobot falls back to pyav automatically, so there is no need to chase this error there.

7. PyAV (av) build failures

Where no prebuilt av wheel exists, pip tries to compile it from source and can fail. The exact text depends on your compiler and which library is missing, so there is no single message to match. The Troubleshooting section of the LeRobot installation docs lists the system packages to install when you hit build errors:

sudo apt-get install cmake build-essential python3-dev pkg-config \
  libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev \
  libswscale-dev libswresample-dev libavfilter-dev

Errors 8 to 12: MuJoCo rendering backends (EGL, OSMesa, viewer)

8. Cannot initialize a EGL device display

The MuJoCo EGL backend source raises this when it cannot initialize any EGL device display:

ImportError: Cannot initialize a EGL device display. This likely means that your EGL driver does not support the PLATFORM_DEVICE extension, which is required for creating a headless rendering context.

MUJOCO_GL=egl relies on the EGL device extension in the NVIDIA driver, so it fails here when there is no GPU or the container does not expose the graphics libraries. If you do not strictly need GPU rendering, switch to MUJOCO_GL=osmesa (CPU software rendering) and get training and evaluation running first. The same file also contains EGL failed to find a framebuffer configuration ..., Cannot create an EGL context. and Failed to make the EGL context current.. Those mean the display was found but context creation failed, so look at the driver installation and GPU memory state first.

9. Cannot use EGL rendering platform (PYOPENGL_PLATFORM conflict)

MuJoCo’s EGL and OSMesa backends check PYOPENGL_PLATFORM at import time. If another library or your shell profile already set a different value, import stops with:

ImportError: Cannot use EGL rendering platform. The PYOPENGL_PLATFORM environment variable is set to 'osmesa' (should be either unset or 'egl').

The OSMesa variant starts with Cannot use OSMesa rendering platform.. Clear it with unset PYOPENGL_PLATFORM or set it to the same value as MUJOCO_GL.

10. invalid value for environment variable MUJOCO_GL

gl_context.py defines a different set of allowed values per OS, so copying a Linux server config to macOS or Windows triggers this error.

OSAllowed MUJOCO_GL values (besides the common glfw)
Linuxglx, egl, osmesa
macOScgl (when unset, cgl is tried first with glfw as fallback)
Windowswgl

Values such as disable, off or 0 skip GL context loading altogether. When the backend’s dependencies are missing, you instead get Failed to import OpenGL backend (MUJOCO_GL=...) with a hint to check that glfw and pyopengl are installed.

11. MUJOCO_EGL_DEVICE_ID must be an integer between 0 and N

On a multi-GPU server, an out-of-range MUJOCO_EGL_DEVICE_ID produces The MUJOCO_EGL_DEVICE_ID environment variable must be an integer between 0 and {N} (inclusive), got {id}.. When the driver exposes the mapping between EGL devices and CUDA devices, the current source follows the CUDA_VISIBLE_DEVICES order. With CUDA_VISIBLE_DEVICES=2,3, for example, you can pass either the visible-device index 0 or 1 or the CUDA id 2 or 3, which is why it is safer to set both variables together.

12. launch_passive requires that the Python script be run under mjpython on macOS

RuntimeError: `launch_passive` requires that the Python script be run under `mjpython` on macOS

The MuJoCo Python docs explain that on macOS the main thread must handle rendering, so launch_passive has to be started through the mjpython launcher. Run mjpython sim.py instead of python sim.py. On a remote Linux server, trying to open the viewer at all fails because GLFW finds no display; use offscreen rendering (mujoco.Renderer with MUJOCO_GL=egl) there instead.

Errors 13 and 14: traps specific to Apple Silicon

13. You are running an x86_64 build of Python on an Apple Silicon machine

MuJoCo’s __init__.py checks for Rosetta translation and the Python architecture, and blocks the import with:

ImportError: You are running an x86_64 build of Python on an Apple Silicon machine. This is not supported by MuJoCo. Please install and run a native, arm64 build of Python.

This shows up when an Intel Homebrew or an x86_64 conda installer is used on an Apple Silicon Mac. If python -c "import platform; print(platform.machine())" does not print arm64, install the arm64 miniforge and rebuild the environment. MuJoCo 3.17.0 ships only one macOS wheel anyway, tagged macosx_11_0_arm64.

14. The operator ‘…’ is not currently implemented for the MPS device

PyTorch’s MPS fallback source prints this when an op has no MPS kernel:

NotImplementedError: The operator '...' is not currently implemented for the MPS device. ... As a temporary fix, you can set the environment variable `PYTORCH_ENABLE_MPS_FALLBACK=1` to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS.

The fix is what the message says: set PYTORCH_ENABLE_MPS_FALLBACK=1 and rerun, accepting that the affected op runs on the CPU and is slower. If torch.backends.mps.is_available() itself returns False, the check in the PyTorch MPS notes distinguishes the two cases: a torch build without MPS, or a machine below macOS 15.0 or without an MPS-capable device.

PYTORCH_ENABLE_MPS_FALLBACK=1 lerobot-train --policy.device=mps ...

Three things to pin so the same error does not come back

Once a symptom is fixed, freeze the layer that caused it. First, write the Python, LeRobot and MuJoCo versions into environment.yml with ==. Second, on Linux GPU machines, record the torch index you used (cu126, cu128 or cu130) and the nvidia-smi driver version next to it in your README. Third, on headless servers, bind MUJOCO_GL, PYOPENGL_PLATFORM and MUJOCO_EGL_DEVICE_ID to the conda environment so they do not drift between shells.

conda env config vars set MUJOCO_GL=egl MUJOCO_EGL_DEVICE_ID=0
conda env config vars unset PYOPENGL_PLATFORM
pip freeze > requirements.lock.txt

With a stable environment, move on to the SO-101 data collection and ACT training guide to exercise the real training pipeline. If GPU memory becomes the next obstacle, work out batch size and precision requirements first with the SmolVLA fine-tuning VRAM guide.

Common mistakes

  • Assuming pip install lerobot gave you the latest release because it succeeded, then mixing 0.4.x commands with the 0.6.x documentation
  • Installing a Linux NVIDIA driver (.run installer or cuda-drivers) inside WSL2, which conflicts with the libcuda stub that the Windows driver provides
  • Switching to MUJOCO_GL=egl without noticing that another library or shell profile already set PYOPENGL_PLATFORM to osmesa or glx
  • Running an x86_64 Python from Intel Homebrew or an x86_64 conda installer under Rosetta on Apple Silicon, so MuJoCo refuses to import

Pre-flight checklist

  • python -c “import sys, platform; print(sys.version, platform.machine())” prints 3.12.x and the expected architecture (x86_64, aarch64 or arm64)
  • pip show lerobot reports the version you meant to install (for example 0.6.1)
  • The driver version from nvidia-smi is at or above the floor of the torch index you chose (cu126, cu128 or cu130)
  • ffmpeg -version reports a major version between 4 and 9, and your torch/torchcodec pair appears in the compatibility table
  • On a headless server, MUJOCO_GL and PYOPENGL_PLATFORM point to the same backend

Frequently asked questions

What if the error text I see differs slightly from this article?
The MuJoCo, PyTorch and TorchCodec strings here were checked against each repository’s main branch on 2026-10-31. Wording can change between releases, so find the matching section by its key phrase (EGL device display, too old, libtorchcodec and so on) and grep the installed package’s source for the same string to confirm.
Do the same fixes apply inside a Docker container?
The torch-versus-driver relationship and the MUJOCO_GL settings are the same. A container also needs the NVIDIA Container Toolkit to reach the host GPU, and on WSL2 you follow the ‘Running CUDA containers’ steps in NVIDIA’s WSL guide.
Why does a uv source install pin torch to cu128?
According to the LeRobot installation docs, uv sync or uv pip install -e . pins torch and torchvision to the CUDA 12.8 index (driver floor 570.86) through the project configuration. Override it with –force-reinstall and –index-url if you need another variant.

Sources & verification

  1. Hugging Face LeRobot Docs — Installation (Troubleshooting, CUDA variant, ffmpeg)
  2. PyPI — lerobot release history (Requires-Python per version)
  3. MuJoCo Documentation — Python Bindings (mjpython, rendering)
  4. MuJoCo GitHub — python/mujoco/egl/__init__.py (EGL error messages)
  5. MuJoCo GitHub — python/mujoco/rendering/classic/gl_context.py (allowed MUJOCO_GL values)
  6. PyTorch GitHub — c10/cuda/CUDAFunctions.cpp (driver error messages)
  7. TorchCodec README — supported FFmpeg versions and torch compatibility table
  8. PyTorch Docs 2.15 — MPS backend
  9. NVIDIA — CUDA on WSL User Guide

Last verified: