Michael Rabinovich Cursor commited on
Commit
545c818
·
1 Parent(s): 0648533

Dockerfile: swap vtk for vtk-osmesa so off-screen rendering works headless

Browse files

The stock pyvista wheel pulls the stock vtk wheel from PyPI, which is
built with vtkXOpenGLRenderWindow. That render window class needs an
X server even in off_screen mode, so it segfaults the eval worker on
the Space's truly-headless container ("DISPLAY=" with no X11 socket).
The parent ProcessPoolExecutor sees the segfault as BrokenProcessPool
six minutes into the eval, which is exactly the failure mode the
first VTK submission hit.

vtk-osmesa is the same VTK build but compiled against Mesa OSMesa
(pure CPU software rasteriser, statically linked, no display server
required). It shares the `import vtk` namespace so pyvista picks it
up transparently. This is the canonical PyVista headless-Docker fix
(per the PyVista docs + the maintainers' own Docker images). The
wheel lives on Kitware's index, not PyPI proper.

Co-authored-by: Cursor <cursoragent@cursor.com>

Files changed (1) hide show
  1. Dockerfile +11 -0
Dockerfile CHANGED
@@ -43,6 +43,17 @@ ARG CADGENBENCH_SHA=b22a53c
43
  RUN pip install --no-cache-dir \
44
  "cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
45
 
 
 
 
 
 
 
 
 
 
 
 
46
  # Drop privileges. HF Spaces conventionally run as uid 1000 with
47
  # WORKDIR /home/user/app.
48
  RUN useradd -m -u 1000 user \
 
43
  RUN pip install --no-cache-dir \
44
  "cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
45
 
46
+ # The stock `vtk` wheel that pyvista pulls from PyPI is built with
47
+ # vtkXOpenGLRenderWindow, which needs an X server and segfaults the
48
+ # worker on a truly-headless container (no DISPLAY). Swap it for
49
+ # `vtk-osmesa`, the same VTK build but compiled against OSMesa (pure
50
+ # CPU software rasteriser, self-contained, no display server required).
51
+ # This is the canonical PyVista headless-Docker recipe; the wheel
52
+ # comes from Kitware's index, not PyPI proper.
53
+ RUN pip uninstall -y vtk \
54
+ && pip install --no-cache-dir \
55
+ --extra-index-url https://wheels.vtk.org vtk-osmesa
56
+
57
  # Drop privileges. HF Spaces conventionally run as uid 1000 with
58
  # WORKDIR /home/user/app.
59
  RUN useradd -m -u 1000 user \