I did a test build with the Visual Studio generator to see what is going on. Scrolling up through the build log provides the actual error:
File "E:\Software\vtk-build\lib\site-packages\vtkmodules\generate_pyi.py", line 38, in <module>
from vtkmodules.vtkCommonCore import vtkObjectBase, vtkSOADataArrayTemplate
ImportError: DLL load failed while importing vtkCommonCore: The specified module could not be found.
Seems the issue is in vtkmodules/__init__.py, which assumes the VTK DLLs are in vtk-build/bin. For the Visual Studio generators, the DLLs are actually in vtk-build/bin/Release or vtk-build/bin/Debug. As a result, the vtk-python modules are unable to load the VTK DLLs from the build tree.
There are two work-arounds that I can think of:
Intsead of setting VTK_BUILD_PYI_FILES during configuration, do a normal VTK build followed by install and then run python -m vtkmodules.generate_pyi manually. Since the DLLs are in “bin/” in the install tree (e.g. not in “bin/Release/” like in the build tree), vtk-python will be able to use the installed DLLs.
The easiest solution is probably to use Ninja instead of MSBuild, since Ninja doesn’t use Release & Debug subdirectories.