MESA: error: ZINK: failed to choose pdev

I am facing this issue when using the docker image (dolfinx/lab:stable) and trying to plot anything with pyvista.

My environment: Mac OS, docker image (dolfinx/lab:stable with image ID d997cb639c0c), Jupyter notebook

Steps to reproduce the error:
Run the code from https://jsdokken.com/FEniCS-workshop/src/finite_element_method/motivation.html

Error I see:

error: XDG_RUNTIME_DIR is invalid or not set in the environment.
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen

I would suggest googling the error, as it seems related to Ubuntu 24.04 itself (which the docker image uses)

Please note that we would need the full command you use to spawn the docker container to help you further.

Thank you @dokken for the response, I understand that this has got something to do with the underlying OS but this issue is preventing me to render dynamic images.

  1. The command used is
docker run --init -ti -v /Users/xyz/dolfinx-fenics/projects/abcd:/root/shared/ -p 8888:8888 dolfinx/lab:stable

  1. I have been trying to google, stack exchange but yet to meet with any success.
  2. I must be missing something simple but I see this error also in the tutorial page Implementation — FEniCSx tutorial except that one can zoom in or zoom out the rendered images in this page and I can’t do that either on my notebook.

I am going to share what I learnt so far from searching on the web and trying a few things from Pyvista’s docker file

  • Install a few packages stored in requirements.txt pip install -r requirements.txt

  • Install vtk-osmesa with pip install --no-cache-dir --extra-index-url https://wheels.vtk.org vtk-osmesa

  • Then setting the jupyter backend to html , here is an example from pyvista with this addition (apart from start_xvfb)

  • from pyvista import examples
    import pyvista
    pyvista.start_xvfb()
    pyvista.set_jupyter_backend('html')
    mesh = examples.download_notch_stress()
    mesh.plot(scalars='Nodal Stress', component=0, cmap='turbo', cpos='xy')
    
  • requirements.txt

    commotion
    colorcet
    imageio  
    imageio-ffmpeg
    ipywidgets<9.0.0
    jupyter-server-proxy
    jupyterlab<5.0.0
    meshio
    trame>=2.5.2
    trame-vtk>=2.5.8
    trame-vuetify>=2.3.1
    trimesh
    

I might have been mistaken and this may not be the correct approach. Yet, I thought of sharing what seems to work! The flip side is that I have to add this to the docker image and have to keep a custom copy of the same. But until another approach is found…

Thank you!!

Seems like the easiest way around this is to add:


if pyvista.OFF_SCREEN:
    pyvista.start_xvfb(0.1)

to the codes when running through docker.
I’ll update the tutorial with this soon.

On linux I run:

docker run -ti --network=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/root/shared -w /root/shared --rm --entrypoint=/bin/bash ghcr.io/fenics/dolfinx/lab:stable

together with:

xhost si:localuser:root

on the Linux system.

1 Like