# python import error when using vtk from docker image

**URL:** https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432
**Category:** Support
**Tags:** python
**Created:** [August 20, 2024, 8:45am UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432 "2024-08-20T08:45:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mutricyl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mutricyl/32/9195_2.png) [@mutricyl](https://discourse.vtk.org/u/mutricyl)
#### Post date: [August 20, 2024, 8:45am UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432/1 "2024-08-20T08:45:19Z")

</div>

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:

```python
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](https://hub.docker.com/_/python)

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 ?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [August 20, 2024, 7:42pm UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432/2 "2024-08-20T19:42:13Z")

</div>

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)?

---

<div class="post-metadata">

### Author: ![mutricyl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mutricyl/32/9195_2.png) [@mutricyl](https://discourse.vtk.org/u/mutricyl)
#### Post date: [August 21, 2024, 8:27am UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432/3 "2024-08-21T08:27:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 22, 2024, 10:45pm UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432/4 "2024-08-22T22:45:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mutricyl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mutricyl/32/9195_2.png) [@mutricyl](https://discourse.vtk.org/u/mutricyl)
#### Post date: [August 23, 2024, 2:13pm UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432/5 "2024-08-23T14:13:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mutricyl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mutricyl/32/9195_2.png) [@mutricyl](https://discourse.vtk.org/u/mutricyl)
#### Post date: [September 10, 2024, 8:03pm UTC](https://discourse.vtk.org/t/python-import-error-when-using-vtk-from-docker-image/14432/6 "2024-09-10T20:03:49Z")

</div>

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](https://github.com/docker-library/python/issues/956)
