vtk python wrapper problem with compilation

It’s work with the Python that comes with Homebrew.

Thank you very much.

I will try check this on the windows

Hi David,

I tried to compile wrapper on the windows with visual studio compiler.

I did

  1. download VTK 8.2.0 from site vtk.org

  2. cmake -S source_path_of_VTK-8.2.0

  3. cmake --build build_path_of_VTK-8.2.0

  4. cmake --install build_path_of_VTK-8.2.0

  5. my VTK was installed and placed in folder C:/Program Files (x86)/VTK/ (with subfolders lib, bin, include, share)

  6. go in catalog with wrapper source
    https://bitbucket.org/InnaDaymand/vtkgeodesic/src/master/src/ (this is my source with make file)

  7. cmake -S path_of_source_vtkGeodesic

  8. get an error message
    CMake Error at C:/Program Files (x86)/VTK/lib/cmake/vtk-8.2/vtkModuleAPI.cmake:140 (message):
    Requested modules not available:

    vtkWrappingPythonCore
    Call Stack (most recent call first):
    C:/Program Files (x86)/VTK/lib/cmake/vtk-8.2/VTKConfig.cmake:143 (vtk_module_config)
    CMakeLists.txt:18 (FIND_PACKAGE)

===========================================

What I did not right?
Thanks

I have only
vtkWrapping.cmake
vtkWrapPython.cmake

When you configure VTK with cmake, you will have to enable all the features that you need (e.g. python wrapping, build type, shared vs. static libraries, Qt support, etc). I can’t give a detailed example, unfortunately, too busy. Hopefully someone else can help.

thank you for answer,

It means, that I must reinstalled VTK from scratch?
Thanks

Hi David,

I’m sorry to trouble you, but I have a question. I was compiled VTK with VTK_PYTHON_WRAP, and I got my .pyd file and vtk.pyd.

In Python project, I set the PYTHONPATH for external library

  1. Path to vtk
  2. Path to my library.

But when I do

import vtk

and trace this line by start the app, a have an error

ile “C:\Users\Admin\workspace\GeodesicDistance\TA_placeer_at_key_point_v5p0_partial_version.py”, line 1, in
import vtk
File “C:\Program Files (x86)\VTK\bin\Lib\site-packages\vtk.py”, line 32, in
all_spec.loader.exec_module(all_m)
File “C:\Program Files (x86)\VTK\bin\Lib\site-packages\vtkmodules\all.py”, line 7, in
from .vtkCommonCore import *
File “C:\Program Files (x86)\VTK\bin\Lib\site-packages\vtkmodules\vtkCommonCore.py”, line 9, in
from vtkCommonCorePython import *
ModuleNotFoundError: No module named ‘vtkCommonCorePython’

Can you advice me, what I should be done in this case?

Thanks a lot

Are you sure that vtkCommonCorePython.pyd can be found in your PYTHONPATH? I can’t remember where it is put for Windows, possibly “bin\Release” in your VTK build directory.

Thank you very much for help David,

also I have a working wrapper for windows :grinning:

Hi, David,

I need yet your help. I am working with python 3.6 and I need to get wrapper from C++ to Python for VTK 8.1.2. I had downloaded VTK 8.1.2 from link

https://github.com/Kitware/VTK/releases/tag/v8.1.2.

I made build and tried to compile my module with CMakeList.txt file, which I used for compilation my module with VTK 8.2.0.

But I am getting errors by the compilation.

Could you help me please to give example CMakeList.txt for VTK 8.1.2? Or to say me, what is wrong in my CMakeList.txt?

Below is link on my CMakeList.txt

https://bitbucket.org/InnaDaymand/vtkgeodesic/src/master/src/CMakeLists.txt

Thank you very much,
Inna

Update

I had got pyd file, I see it from python, but my python program was crashed during process execution. I am using vtk package vtk 8.1.2 which I installed using pip.

May be I cannot use standart package in this case and should use my build vtk 8.1.2 ?

Thank you

Update

I had understood, what i have to do. I can get package VTK for Python 3.6 from Anaconda cloud, and compile my module. This packages contain as Python library as well C++ libraries and headers, that it gives an occasion to compile wrappers.

Now I don’t need help.

Thank you
Inna