Pyvista requires an x-server (frame-buffer) to plot when running python scripts. This is not activated by default on windows, see: How to use GUI apps in WSL2 (forwarding X server) | Aitor Alonso (aalonso.dev)
You can either
- Follow the instructions above to get an x-server to render the GUI of pyvista
- Set environment variable
PYVISTA_OFF_SCREEN=true
. Start a virtual frame-buffer prior to plotting (pyvista.start_xvfb()
), Add aplotter.screenshot("figure.png")
instead of theplotter.show()
. This will save apng
of the figure.