python import error when using vtk from docker image

I have a python project using vtk hosted on a gitlab server. I’am trying to run CI/CD for that project but they all fail when importing vtk:

import vtkmodules.vtkRenderingOpenGL2
ImportError: DLL load failed while importing vtkRenderingOpenGL2: The specified module could not be found.

of course vtk has been installed previously with pip.

My gitlab runner runs on windows using docker. I am using python official docker image

This is not a gitlab issue as I have the same problem with I try to load vtk directly from docker.

I guess some dll are missing in the docker image but it is difficult to investigate. Do you have any idea to solve this issue or to find the missing dll ?

The name of the missing DLL would help. Unfortunately, Python is tight-lipped about it (though I think 3.10 improved this reporting). Does importing any VTK module work (vtkCommonCore would be the main one to try)?

The following are included in the code and import correctly:

  • vtkCommonDataModel
  • vtkCommonTransforms
  • vtkFiltersCore
  • vtkFiltersExtraction
  • vtkFiltersGeneral
  • vtkFiltersGeometry
  • vtkFiltersModeling
  • vtkIOGeometry
  • numpy_interface
  • vtkIOImage
  • vtkInteractionStyle
  • vtkRenderingCore
  • vtkRenderingFreeType

I’ll try vtkCommonCore tomorrow

Which vtk version are we talking about?
Is it locally built?

I am using vtk 9.3.1 from pip (so not locally built)

Thanks to the docker python folks I have solved my import error issue. Windows docker image (and likely linux images also) are missing graphic card drivers. These drivers come with openGL libraries that are required by vtk libraries.

It is then necessary to install some openGL libraries to solve the issue (mesa openGL is working fine)

docker python issue/discussion for the record