Building VTK#
Kitware publishes VTK wheels on PyPI, and PyVista installs those by default. Building VTK from source is for the cases they do not cover: a new Python release, a VTK branch or commit, GPU off-screen rendering, or a module the published wheel leaves out.
pyvista-build does that with one command on Linux, macOS, and Windows, using the options PyVista’s own CI uses:
pip install pyvista-build
pyvista-build vtk
The wheel is built for, and installed into, the active virtual environment. Once installed, PyVista picks it up like the stock one. Its documentation covers:
The steps of a build, and the flags that change each one.
Scripted use and the developer loop of editing VTK and rebuilding.
Portable Linux wheels built inside a manylinux container.
CI workflows with a compiler cache.
The command reference.
PyVista’s nightly VTK master build runs the same command against VTK’s master branch on all three operating systems and tests PyVista against the result.
Off-Screen Plotting GPU Support#
The stock Linux wheels already render off-screen without an X server: VTK picks EGL for GPU rendering, or OSMesa for software rendering, at run time. To build a wheel that does not link against X at all:
pyvista-build vtk --with headless
Such a wheel cannot open on-screen windows, so use it only where you save
static images or stream the render window to another computer with a
display (for example, using pyvista.set_jupyter_backend('server') and
JupyterLab). See Off-Screen Plotting GPU Support.