Hello,
I have a relatively complex use-case that I will try to describe as best as I can. We (my company) uses Docker for our development. We would like to add visualization capabilities to this code using e.g. pyvista, and we would like it to be multiplatform. Our users are data scientists and engineers who may be either on an ARM or an Intel Mac, so we would like to support both architectures. And we’re using Python so of course we’ll need the Python bindings.
I’m attempting to solve this problem by building VTK from source within the image with -DVTK_WRAP_PYTHON=ON
. On the host machine (an M1 Mac), I am running XQuartz, and I have set up X redirection between the Docker image and the host so that if I e.g. run xclock
I can see the clock on the host. I can also run glxgears
and see the gears. The build succeeds and I am able to import vtk
and use it without any problems, until I actually try to display something, at which point everything crashes. Here’s an example, using the following pyvista code:
import pyvista as pv
import numpy as np
def get_fresh_plotter():
plotter = pv.Plotter()
xyz_arr = np.random.rand(30000).reshape(10000, 3)
wire_cloud = pv.PolyData(xyz_arr)
plotter.add_mesh(wire_cloud, opacity=0.5, color=(1.0, 0.5, 0.5))
xyz_arr = np.random.rand(30000).reshape(10000, 3)
xyz_arr[:, 0] += 3.0
wire_cloud = pv.PolyData(xyz_arr)
plotter.add_mesh(wire_cloud, opacity=0.5, color=(0.5, 0.5, 1.0))
return plotter
get_fresh_plotter().show(interactive=False, screenshot="pyvista_out_1.jpg")
get_fresh_plotter().show(interactive=True, screenshot="pyvista_out_2.jpg")
And here’s the error that results:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
2022-09-16 19:22:31.396 ( 0.185s) [ 80D80D30]vtkOpenGLRenderWindow.c:517 ERR| vtkXOpenGLRenderWindow (0xaaaad4f91020): 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.
ERROR:root: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.
2022-09-16 19:22:31.398 ( 0.187s) [ 80D80D30] vtkOpenGLState.cxx:83 WARN| Error in cache state for GL_BLEND
2022-09-16 19:22:31.399 ( 0.188s) [ 80D80D30] vtkOpenGLState.cxx:90 WARN| Error in cache state for GL_DEPTH_TEST
2022-09-16 19:22:31.400 ( 0.189s) [ 80D80D30] vtkOpenGLState.cxx:105 WARN| Error in cache state for GL_MULTISAMPLE
2022-09-16 19:22:31.401 ( 0.190s) [ 80D80D30] vtkOpenGLState.cxx:113 WARN| Error in cache state for GL_SCISSOR_TEST
2022-09-16 19:22:31.402 ( 0.192s) [ 80D80D30] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2022-09-16 19:22:31.403 ( 0.192s) [ 80D80D30] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2022-09-16 19:22:31.404 ( 0.194s) [ 80D80D30] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2022-09-16 19:22:31.405 ( 0.194s) [ 80D80D30] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2022-09-16 19:22:31.409 ( 0.198s) [ 80D80D30] vtkOpenGLState.cxx:274 WARN| at stack loc
0xffff72e21314 : ??? [(???) ???:-1]
0xffff72e21c64 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.2.so.1) ???:-1]
glxinfo shows the following:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
OpenGL vendor string: Apple
OpenGL renderer string: Apple M1 Pro
OpenGL version string: 1.4 (2.1 Metal - 76.3)
OpenGL extensions:
At this point I’m quite lost. Perhaps what I’m trying to do is impossible, or perhaps I’m building VTK with the wrong options, but if anyone has gotten such a case to work or has any suggestions for what I should try, I’d love to hear it. What I’m after ultimately is for our data science users to be able to create interactive visualizations without leaving the Docker container. Thanks in advance for any help.