Plot error using pyvista

Hello everyone, I’m a newer for dolfinx. I have installed dolfinx/lab using docker. I’m trying to follow the tutorial about Solving the Poisson equation, it raises the error when plot the function and mesh using pyvista:

Error displaying widget: model not found

The code is exactly the same with the tutorial. The official document of pyvista Jupyter Notebook Plotting — PyVista 0.33.0 documentation said that using itkwidgets and ipyvtklink will trigger this error. However, the error still exists when using ipygany and pythreejs. I really don’t know how to fix it. Has anyone encountered this problem?

You need to add the following to the notebook:

!pip3 install pyvista pythreejs ipygany --upgrade
!jupyter nbextension enable --py --sys-prefix ipygany

Then execute the code in the notebook. You will still encounter the error after calling these comamands.

However, if you now close your browser, reopen the jupyter-lab notebook it should all work.

3 Likes

Dr dokken,

It works! Thanks a lot.

If you need this to make the tutorial work, then it seems like this should be mentioned in the tutorial.

1 Like

The tutorial is open source, and anybody can contribute with content to it at: GitHub - jorgensd/dolfinx-tutorial: A reimplementation of the Springer book: https://github.com/hplgit/fenics-tutorial/, covering new topics as well as transitioning from dolfin to dolfinx

If i find time for it over the weekend i will add a note to the section:
https://jorgensd.github.io/dolfinx-tutorial/fem.html#obtaining-the-software

Please note that this is not required if you intend on using the interactive jupyter-notebooks as described in:
https://jorgensd.github.io/dolfinx-tutorial/fem.html#interactive-tutorials