Local libraries with Python wrapping

I’m after advice on the current recommended route for creating a local library for which the
classes can be wrapped [Python]
Previously releases provided an
Examples/Build/vtkLocal directory that could be used as a template for local libraries.
This seems to have been deprecated at least its not in the git archive.
The replacement Examples/Build/vtkMy provides scaffolding for a local library
but des not seem to support wrapping, at least not via Python. The classes in the
example library are used via C++. Am I missing something, or is there an
example somewhere of a local library with wrapped classes that I could follow?

I’ve nothing against going back to 1st principles and starting again from CMake
but there used to be a good solution and if the problem is already solved
its unnecessarily wasteful.


The new example is here. In VTK 9, the wrapping of local libraries is more-or-less automated (more so than before), but the local libraries must be structured as a VTK module.

In the example, the important pieces are:

  1. A subdirectory (the module, any name can be used) with a vtk.module file
  2. A CMakeLists.txt file with vtk_module_wrap_python to wrap the module

Thanks David, Exactly what I was looking for. However In trying to built the local example as included as a test
I’ve run into issues:

1.CMake Error at CMakeLists.txt:11 (include):
include could not find requested file:


If I look in /usr/local/libcmake/vtk that macro is indeed not present
I find it present when using 6.1, 6.3, 7.1, 9.0

If I cp the file to the 9.1 dir and rererun cmake I get

include could not find requested file:

made me wonder if the problem is in cmake concatenating
${VTK_CMAKE_DIR} with the filename . However
the core vtk build is fine. I’ve tried multiple versions
of Cmake.

2.from line 8 of CMakeLists
The VTK_USE_FILE is no longer used starting with 8.90

I’m using CMake 3.8.0 to satisfy the version constraint 3.8…3.12
I’m having the issues with both the VTK-9.0.1 tarball and the git head.

Any suggestions?

Hi David, the example that I pointed to is Examples/Modules/Wrapping

It’s very possible that the old Examples/Build/vtkLocal is not working anymore.

Edit: The vtkLocal example was removed from ‘master’ in March, and it’s not in the current release branch either. So it’s a dead end, it’s been superseded by the Examples/Modules examples.

Thanks David for theclarifications, got that working now.