Pyvista docker installation

Hello Community,

I had a new computer and I’d like to install FEniCSx. I’m used to docker so I’ve used the docker image dolfinx/dolfinx:stable.
In term of FEniCSx, everything works. But based on a tutotrial code such as the Poisson equation implementation here, pyvista is not natively installed in the docker container.
Using pip install pyvista leads me to the following error:

[…]
Obtaining dependency information for pyvista from https://files.pythonhosted.org/packages/4f/ac/ae04079344705fd7720032b8f945bc25d410cee090fcd01106a2ac1098db/pyvista-0.25.2-py3-none-any.whl.metadata
Using cached pyvista-0.25.2-py3-none-any.whl.metadata (11 kB)
Using cached pyvista-0.25.1.tar.gz (1.2 MB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in pyvista setup command: ‘python_requires’ must be a string containing valid version specifiers; Invalid specifier: ‘>=3.5.*’
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I’ve firstly asked to question on the pyvista github QA. And we have figured out 2 things, the first one is that it has nothing to do with pyvista because ‘pip install pyvista’ works on my machine. The second one is that it can be an issue with vtk.
Indeed, running `pip install vtk´ returns this error:
ERROR: Could not find a version that satisfies the requirement vtk (from versions: none)
ERROR: No matching distribution found for vtk

I’ve tried many things to install pyvista by specifing a version and so on, but it always leads me to the error at the end.

Thank you for help,
Pierre

P.S.: It is the same issue with the docker for JupyterLab

Can’t reproduce in a clean docker image on Debian amd64. Note that pyvista 0.25 is ancient, the current version is 0.43.4. With the information we have, the best guess is that you have customized the docker image in some way which made it incompatible with vtk.

Thank’s a lot for this fast response Francesco,
To be fair I’ve just used the image such as:
docker run -ti dolfinx/dolfinx:stable

It provides me a container, and in the bash of this container the command ´pip install pyvista´ or even ´pip install pyvista==0.43´ led my to the error exposed before. I’ve not customized anything (at least not intentionally).

Are you using a mac?
VTK does not supply wheels for mac, but @finsberg made a binary that you can use at: Pyvista not available with docker due to lack of vtk - #16 by Henrik_Nicolay_Finsb

Yes Sir, my new computer is a mac…
I’m gonna ask a naive question, but what do I have to do with the

RUN dpkgArch="$(dpkg --print-architecture)"; \
    case "$dpkgArch" in arm64) \
    python3 -m pip install "https://github.com/finsberg/vtk-aarch64/releases/download/vtk-9.2.6-cp310/vtk-9.2.6.dev0-cp310-cp310-linux_aarch64.whl" ;; \
    esac;
RUN python3 -m pip install pyvista

code ? Where should I put it ? in the .dockerenv file ?

Little update:

I used the docker image from @jpdean, and the command ‘pip install pyvista’ has worked perfectly, as it was on my machine from the terminal (M3 macbook)

You would simply call this command in your docker container

Thank you @dokken, it works perfectly,
For next people seeing this post: I’ve ran it without the double semicolon and the backslash at the end. It installed vtk, and running ‘pip install pyvista’ just after works as it should.