Import issue of vmtk libraries

I am trying to re-use the code.

In the script there are 2 imports that interest me :

  •       import vtkvmtkComputationalGeometryPython as vtkvmtkComputationalGeometry
  •       import vtkvmtkMiscPython as vtkvmtkMisc

I found the two libraries in the extension folder of vmtkSlicer with a .pyd extension and copied them in my folder project.

Unfortunately, when I launch my python script importing this libraries, it fails to import those.
Those anyone know how to use this libraries and how to import them?


What Python environment do you use for your project?

I am using the anaconda environment with Python 3.8.

@lassoan I downgraded my version of Python to 3.6 in order to meet the installation of vmtk but I am still not able to import the libraries.

I get the following error :

Traceback (most recent call last):
File “”, line 16, in
import vtkvmtkMiscPython as vtkvmtkMisc
ImportError: DLL load failed: The specified module could not be found.

I am stuck, I don’t understand why it can’t access to the library…

You probably need to add the folder that contains the DLLs to you PYTHONPATH environment variable. Also make sure that all other DLLs that VMTK DLLs depend on (such as entire VTK) are available on the path. You can use Dependency Walker to find out what DLLs you need.

1 Like

Thanks a lot, it worked, I didn’t know about Dependency Walker, it is a very useful tool !

1 Like