Mayavi crashing in Colab Jupyter Notebook

66 Views Asked by At

I am having trouble getting the 3D visualisation toolkit mayavi to work in a Colab notebook.

I am using the following to bring in the required dependencies:

!pip install vtk==9.2.6
!pip install mayavi

This appears to work without error. The reason for choosing vtk==9.2.6 is that without it, a warning is given that there is a version mismatch between vtk 9.3 installed and that used to build the library 9.2.

The library is imported as follows.

# import libraries
from mayavi import mlab
mlab.init_notebook()
mlab.options.offscreen = True

Again, this doesn't fail but shows a warning:

/usr/local/lib/python3.10/dist-packages/traits/etsconfig/etsconfig.py:425: UserWarning: Environment variable "HOME" not set, setting home directory to /tmp
  warn(
Notebook initialized with ipy backend.

I think I can ignore this.

When running the following standard small test code, the Colab server crashes.

s = mlab.test_plot3d()
s

The crash logs suggest the issue may be to do with rendering X/opengl backend but this is beyond my expertise.

[0m[31m2023-12-17 14:05:08.330 ( 151.641s) [ CF990000]vtkXOpenGLRenderWindow.:464 ERR| vtkXOpenGLRenderWindow (0x56593cdec8b0): bad X server connection. DISPLAY=[0m

I'll give today's date (17th Dec 2023) as it seems at different points in time, different versions worked and didn't.

0

There are 0 best solutions below