Startup fails: the Docker image ships without libGL โ€” the second FROM stage discards the stage that installed it

#6
by nootxlm - opened

This Space fails at startup with:

OSError: libGL.so.1: cannot open shared object file: No such file or directory

raised importing open3d (via lib/dataset/mesh_util.py).

The cause is in the Space's own Dockerfile. It has two build stages:

  1. FROM nvidia/cuda:11.6.1... โ€” this stage installs the system libraries, including libgl1 / libgl1-mesa-glx.
  2. FROM python:3.8 โ€” a second, fresh final stage.

The final image is built from the second stage alone: nothing is copied forward from the CUDA stage (no COPY --from=...), so the shipped image contains neither the CUDA base nor the libGL libraries the first stage installed, and open3d cannot load.

Fix: build the final stage on the CUDA stage instead of starting over from python:3.8 โ€” delete the second FROM python:3.8 line so the installs in the first stage are the ones that ship (or copy the needed apt layer forward explicitly). After rebuilding, python -c "import open3d" inside the image is the check that proves it.

Sign up or log in to comment