This is the first time I use python to run vtk. I got the following errors when the code ran to the following line.
renderWindow = vtkRenderWindow()
The error message is,
2025-08-22 11:11:25.167 ( 0.546s) [ 75B0D0CF9740]vtkXOpenGLRenderWindow.:221 ERR| vtkXOpenGLRenderWindow (0x1d048ca0): Could not find a decent config
2025-08-22 11:11:25.167 ( 0.546s) [ 75B0D0CF9740]vtkXOpenGLRenderWindow.:447 WARN| vtkXOpenGLRenderWindow (0x1d048ca0): Could not find a decent visual
2025-08-22 11:11:25.170 ( 0.550s) [ 75B0D0CF9740] vtkEGLRenderWindow.cxx:385 WARN| vtkEGLRenderWindow (0x1d044580): Setting an EGL display to device index: -1 require EGL_EXT_device_base EGL_EXT_platform_device EGL_EXT_platform_base extensions
2025-08-22 11:11:25.170 ( 0.550s) [ 75B0D0CF9740] vtkEGLRenderWindow.cxx:390 WARN| vtkEGLRenderWindow (0x1d044580): Attempting to use EGL_DEFAULT_DISPLAY...
2025-08-22 11:11:25.170 ( 0.550s) [ 75B0D0CF9740] vtkEGLRenderWindow.cxx:395 WARN| vtkEGLRenderWindow (0x1d044580): Could not initialize a device. Exiting...
2025-08-22 11:11:25.170 ( 0.550s) [ 75B0D0CF9740]vtkOpenGLRenderWindow.c:794 WARN| vtkEGLRenderWindow (0x1d044580): Failed to initialize OpenGL functions!
2025-08-22 11:11:25.170 ( 0.550s) [ 75B0D0CF9740]vtkOpenGLRenderWindow.c:813 WARN| vtkEGLRenderWindow (0x1d044580): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.
2025-08-22 11:11:25.170 ( 0.550s) [ 75B0D0CF9740]vtkOSOpenGLRenderWindow:152 WARN| libOSMesa not found. It appears that OSMesa is not installed in your system. Please install the OSMesa library from your distribution's package manager.
This is ubuntu 24.04.2 LTS desktop. I can run vtk.js with no problem.
I check OpenGL with the following command.
glxinfo | grep "OpenGL renderer"
The result is,
OpenGL renderer string: Mesa Intel(R) HD Graphics 4000 (IVB GT2)
That seems like a strange place for VTK to fail. On X11, VTK does the following:
open an X11 display connection (succeeded)
load glx (succeeded)
find a usable glx framebuffer configuration (failed)
get a glx visual
create an OpenGL context
The most common places to see a failure are 1, 2, and 5. For systems with old graphics hardware, failure usually happens at 5 because the hardware doesn’t provide the needed OpenGL capabilities.
A failure at 3, as shown by your error printout, is strange. It means that VTK wasn’t able to find a usable framebuffer configuration (shown in the “GLXFBConfigs” section of the glxinfo printout). All that VTK requires at this stage is an rgba colorbuffer and a depth buffer. Perhaps no FBConfig with alpha exists on your system?
For debugging this problem, it’s best to create a vtkXOpenGLRenderWindow directly, rather than relying on VTK’s autodetection for the best window type:
Can you run the same commands interactively to find out which command causes the segfault?
I’m not sure if conda is the problem, the VTK that comes with conda is packaged by the conda folks and I’m not very familiar with it. The official vtk-python package (the one provided by the VTK developers) is the one on pypi that is installed via pip.
As a test, can you create a new environment and then install vtk with pip, to see if it behaves differently?
Regarding the segfault, VTK will often print an error message before a segfault occurs, but in this case it seems that it didn’t.
Who knows why the conda package failed. My only guess is that there might have been a problem with the libraries that VTK finds on your system, maybe VTK was using one of the system-supplied libraries when it should have been using a conda-supplied library instead (libraries like libglvnd, libglx, libopengl, libglad). If you’re curious you can play around with the ldd command to see what libraries libvtkRenderingOpenGL2-9.4.so links to in your environment.