PyVista interactive plot hangs on Binder

Hi,
I am trying to display PyVista interactive plots in a Binder instance, but it hangs (displays “Loading …” with a wheel that spins for ever). The notebook does work locally.

I set up the Binder instance with the recommended apt.txt and start files as indicated in PyVista’s documentation, section “Running on MyBinder”.

Regarding the start file, I’m not sure how it should write. At first I did a straight copy/paste of the commands and at that point, the interactive plots would throw a 424 error.

I edited slightly (but maybe incorrectly) from this :

Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3

to this (i.e. moved sleep 3 to the previous line) :

Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & sleep 3

Which led me to see the “loading” spinning wheel animation.

On another note, I have tried both the Trame “server proxy” and the “Jupyter extension” (within code cells in my example notebook, not by setting env variables in the start file) approaches suggested in this issue thread, to no avail.

Any tips ?

Can you share a link to the repo you’re trying to run on mybinder?

Hi,
Here is the URL : Binder

Here is how I built the binder instance :

  • select “Git repository” (selecting “Gitlab” did not work, I guess because it is a custom Gitlab instance)
  • URL: DEAL public / PASE · GitLab
  • Git ref: 152-pase-training-session (edit: since I am using branch 152)
  • File to open: example.ipynb

I tried the following, which returns error 424 :

import pyvista as pv
pv.set_jupyter_backend('trame')
pv.global_theme.trame.jupyter_extension_enabled = True
import matplotlib
from pyvista import demos
demos.plot_wave()

And the following, which hangs indefinitely :

import pyvista as pv
pv.set_jupyter_backend('trame')
pv.global_theme.trame.jupyter_extension_enabled = False
pv.global_theme.trame.server_proxy_enabled = True
pv.global_theme.trame.server_proxy_prefix = '/proxy/'
import matplotlib
from pyvista import demos
demos.plot_wave()

Thanks for taking the time to look into it.

The tutorial, updated as recent as days ago in 2025, runs on MyBinder fine as evidenced from running the cells in tutorial/00_jupyter/jupyter.ipynb in a session launched via this link.

The easier way to set up one that works then is to fork or clone the source repo:

https://github.com/pyvista/pyvista-tutorial/gh-pages

Make sure you use the correct branch.

The documentation you are referencing seems neglected as the source repo they reference at the bottom of that section, https://mybinder.org/v2/gh/OpenGeoVis/PVGeo-Examples/master , to use as a guide doesn’t launch at present because it hasn’t been updated in a long time. Maybe more importantly, the start file can be much simpler these days as seen in pyvista-tutorial/binder/start at ae0f864458b334ecc63cda067baffa3845187bef · pyvista/pyvista-tutorial · GitHub .

1 Like

The tutorial does work, thank you for pointing that out.

I adapted the start file according to your recommendation. Now I don’t get a 424 error, I moved on to 404 error in the cell output where I try to generate a 3D plot (i.e. I do have access to the notebook on binder, but it displays a 404 error in the cell output).

I also checked the output of pv.Report() to compare my instance with the one you provided (the working tutorial), and the pyvista version shows 0.45.2 in both, which confuses me even more.

Output of pv.Report() on my instance:

Output of pv.Report() on the tutorial instance:

I do see that jupyter_server_proxy package is installed in the tutorial instance and not mine, I will look on that side. edit: so I added it to environment.yml. It did install the same version (4.4.0) and now I get a warning as output of pv.Report():

2025-06-05 18:55:27.901 ( 2.801s) [ 7A66F7842440]vtkXOpenGLRenderWindow.:1416 WARN| bad X server connection. DISPLAY=

There are some other differences, like the Render Window and vtk version.

If you have any tips I would be very grateful.

Cheers

Could it somehow be related to this ?

I also think from this (long) SO answer that the start file may still have to contain the commands that start a virtual display :

export DISPLAY=:99.0
export PYVISTA_OFF_SCREEN=true
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 1 

My suggestion was take the entire repo and adapt it to your content. In fact, maybe you should test the copy of the tutorial repo first since your aren’t using GitHub. Maybe it uses some GitHub workflow to help it work?

Plus, even in the tutorial session from PyVista, you may want to check all works. I saw a 3D view in that one notebook and assumed all was good.

Note that the binder directory is using a dockerfile to set things up for the Binder sessions. In that directory is just the start and dockerfile that mybinder uses for configuration.


Then after you are sure the copy works, you can adjust things. It is always best to start with something working and see what breaks it then start with something not working and try to make it work piecemeal.

1 Like

Hi Wayne,

I’m not sure what you mean. My application is a modeling framework that uses PyVista, I’m not building upon PyVista so I can’t really clone the PyVista repo and adapt it, or perhaps I misunderstood ?

I’m trying to better grasp how Binder is configured but I feel there is a lapse in my knowledge base somewhere.

Regarding this, I tried the following :

  • adapt environment.yml to ressemble the PyVista requirements.txt a bit more
  • did %conda uninstall vtk and %pip install --no-cache-dir --extra-index-url https://wheels.vtk.org vtk-osmesa as suggested by the jupyter.Dockerfile (even if it’s probably not ideal to mix conda and pip)

Still no luck … The bad X server connection warning is no longer present but I still get Error 404.

Found a solution/workaround : if I set the jupyter backend as html instead of trame, I get the interactive plot I was aiming for.

So either :

import pyvista as pv

# Set/enable the backend
pv.set_jupyter_backend('html')

or

pl = pv.Plotter()
pl.add_mesh(pv.ParametricKlein())
pl.show(jupyter_backend='html')

Not quite sure why trame backend does not work. Also this works without having to uninstall vtk + reinstall vtk-osmesa (my last post).

1 Like

Glad to hear you got it working and thanks for sharing here what was needed for others with the issue or possibly future you.

Just for clarifaction:
My idea was to at least get the tutorial branch over to GitLab and make sure it works from there first. I guess the tutorial one being based on a Dockerfile made that harder to combine with yours and so I can see your hesitation in working much on that.

And thank you for offering ideas. I was preparing to answer your latest message when I stumbled accross what ended up being the solution to my issue :slight_smile:

Cheers

1 Like