# Problem about pyvista

**URL:** <https://fenicsproject.discourse.group/t/problem-about-pyvista/8912>\
**Category:** installation\
**Created:** [August 4, 2022, 8:53am UTC](https://fenicsproject.discourse.group/t/problem-about-pyvista/8912 "2022-08-04T08:53:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![dparsons](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dparsons](https://fenicsproject.discourse.group/u/dparsons)\
**Post date:** [August 4, 2022, 9:53am UTC](https://fenicsproject.discourse.group/t/problem-about-pyvista/8912/3 "2022-08-04T09:53:58Z")

</div>

For the record, my student installed WSL2, installed pyvista (and scooby) via pip. It worked (displayed plots) without further configuration. I don’t know why it worked in our case but doesn’t work in others, sorry! dokken’s links will be useful.

One suggestion for debugging is to check basic matplotlib functionality. Does matplotlib give the same error? e.g.

```auto
python3 -c "import matplotlib.pyplot as plt; import numpy; x=numpy.linspace(0,10,100); plt.plot(x,x); plt.show()"

```

Does matplotlib display the simple plot?

In regards to the WSL2 environment, it installs Ubuntu. Always use the ubuntu packages where possible, and _don’t_ use pip to install packages. e.g. install matplotlib via

```auto
apt-get install python3-matplotlib

```

I mention this in case the reason pyvista (or matplotlib) worked for us and not for you is if you used pip instead of apt to install matplotlib. You can check which matploblib you’re using via `python3 -c "import matplotlib; print(matplotlib. __path__ )"`

The situation is more complicated then we’d like it to be since ubuntu does not have its own pyvista package available yet (a request to make it available was made in Debian [Bug#1001105](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001105)). pip installation is a workaround which carries the danger of installing python packages with incompatibile library versions. The risk can be reduced by using the `--no-deps` option to only install the specified packages and not pull in other package dependencies.

pyvista requires numpy, imageio, pillow, appdirs and vtk, which are all available for ubuntu. It also requires scooby, which, like pyvista, is not yet available for ubuntu. Hence to get pyvista installed on an ubuntu/debian system (including the WSL2 environment), I recommend:

1. check that numpy, imageio, pillow, appdirs and vtk have _not_ been installed by pip  
– inspect the contents of `~/.local/lib/python3*/site-packages/`  
– remove any unwanted packages (delete the directory, or use `pip uninstall <package>`)

2. check that they _have_ been installed by apt

```nohighlight
apt-get install python3-numpy python3-imageio python3-pil python3-appdirs python3-vtk9

```

(you could use `python3-vtk7` instead of `python3-vtk9` if vtk9 is giving problems)

1. install pyvista with

```nohighlight
pip install --user --no-deps scooby pyvista

```

---

_[View the full topic](https://fenicsproject.discourse.group/t/problem-about-pyvista/8912)._
