How to use pyvista in Docker for Windows 10 user

Hello,

I install FEniCSx in Windows 10.
Following the guide obtaining-the-software, I install FEniCSx in docker by

docker run -ti -v D:/work-fenicsx:/root/shared --name fenicsx-container dolfinx/dolfinx

Then I download demo_poisson.py,
and run

python3 demo_poisson.py

in container.
The system tells

pyvista is required to visualise the solution

I’m not familier to Docker.
I want to know how to install pyvista in Docker container?
Thanks

Pyvista can be installed in a docker container with the following commands:

export PYVISTA_OFF_SCREEN=true
apt-get update
apt-get install -y --no-install-recommends libgl1-mesa-dev xvfb
pip3 install pyvista

Running the demo after this command will save the plot to “u.png”: dolfinx/demo_poisson.py at main · FEniCS/dolfinx · GitHub
If you want interactive visualization when using Windows, i suggest you use Paraview to open the resulting XDMFFile: dolfinx/demo_poisson.py at main · FEniCS/dolfinx · GitHub

1 Like

This is just a comment for making pyvista work in the image dolfinx/lab:stable version 0.7.2, window 10.

pyvista version 0.42.2
jupyter lab 4.0.8
vtk 9.3.0

This worked for me:

pip install trame
pip install trame-vuetify
pip install trame vtk
pip install jupyter-server-proxy

add
pyvista.global_theme.trame.server_proxy_enabled=True

and check if
pv.global_theme.trame.server_proxy_prefix is /proxy/