pyvista: Setting Jupyter backend to Trame hangs and displays blank widget

Describe the bug, what’s wrong, and what you expected.

Setting the Jupyter backend to Trame hangs on my laptop, i.e. the cell will not finish executing until I run another cell. When I then plot, only a text string Widget(value="<iframe...) is displayed. I tried using either of the three Trame backend options (trame, server, client).

I tried the other backends, and turns out the only one displaying a plot in the notebook is panel. Passing Sphere().plot(notebook=False) displays the plot in a separate window, as normal.

Couldn’t find anything about this among the other issues or PRs, so I assume it’s just me forgetting something important or my system lacking some compatibility…

Steps to reproduce the bug.

The following commands are run in a Jupyter notebook:

import pyvista as pv
pv.set_jupyter_backend('trame')  # Hangs
pv.Sphere().plot()  # Prints:
# Widget(value="<iframe src='http://localhost:36679/index.html?ui=P_0x7f7051a6fdf0_0&reconnect=auto' style='widt…

The source link points to a perpetually loading blank page.

System Information

--------------------------------------------------------------------------------
  Date: to. feb. 09 13:19:04 2023 CET

                  OS : Linux
              CPU(s) : 4
             Machine : x86_64
        Architecture : 64bit
                 RAM : 15.5 GiB
         Environment : Jupyter
         File system : ext4
          GPU Vendor : Intel
        GPU Renderer : Mesa Intel(R) HD Graphics 620 (KBL GT2)
         GPU Version : 4.6 (Core Profile) Mesa 22.2.5

  Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:20:04) [GCC
  11.3.0]

             pyvista : 0.38.1
                 vtk : 9.2.5
               numpy : 1.23.5
             imageio : 2.25.0
              scooby : 0.7.1
               pooch : v1.6.0
          matplotlib : 3.6.3
               PyQt5 : 5.15.7
             IPython : 8.9.0
               scipy : 1.10.0
                tqdm : 4.64.1
          jupyterlab : 3.6.1
               trame : 2.3.0
        trame_client : 2.5.1
        trame_server : 2.9.0
           trame_vtk : 2.0.17
jupyter_server_proxy : 3.2.2
--------------------------------------------------------------------------------

Screenshots

Hanging cell:

bilde

Non-displayed widget:

bilde

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

This is getting more and more perplexing… Glad it’s working for you now but the version of MPL/Qt should not affect this at all. I’ll have to dig into why having PyQt5 might break this…

The window is still blank after running your above commands with PyVista 0.38.2, just replacing launch_server() with launch_sever().ready:

bilde