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