Hi - I’ve been trying to figure out how to get vtk to work with python 3.8, and in particular in making a wheel for easy installation. The basic vtk functionality works when compiling from source (using the patch from https://gitlab.kitware.com/vtk/vtk/uploads/cf7f517b4f647de1997c4e8cddb54de9/0001-Compatibility-for-Python-3.8.patch), including the python wrapping module which allows my python application to work. I was also able to modify the wheel building infrastructure from https://github.com/KitwareMedical/VTKPythonPackage and got it to compile and apparently install. The changes were minimal (and I’d be happy to post the patch if it’s useful), mostly applying the source patch above, changing
python3 -m venv, and changing some paths and version numbers. I also created a dummy
libpython-not-needed-symbols-exported-by-interpreter that is actually a library, not an empty file, to deal with the problems mentioned in http://vtk.1045678.n5.nabble.com/vtk-8-2-0-rc2-problem-building-wheels-td5749301.html.
This process creates a wheel that I can install with pip, but the resulting directory structure is very weird. When I directly install from source I get a bunch of
libvtk*.so files in
PREFIX/lib/python3.8/site-packages. If I add those to DYLD_LIBRARY_PATH and PYTHONPATH things works fine. However, the wheel (which is installing to the Mac OS user directory PREFIX=~/Library/Python/3.8), creates a
vtk/ directory in
PREFIX/lib/python/site-packages. In that
vtk/ directory it creates an empty stub
__init__.py, a bunch of
libvtk*dylib files, and a
python3.8/site-packages directory which containts
vtkmodules/. With this setup I can
import vtk, but
import vtk.util fails with a ModuleNotFound error. I’m pretty sure that if I manually move the files into the a directory structure identical to that created by the build-from-source process, it works, so the actual library and python files are probably OK. It just looks like the wheel building process appends an extra
vtk/python3.8/site-packages to the path, or something like that.
Is anyone still interested in creating a wheel file for vtk with python 3.8 (as that old mailing list thread suggested people were at one point)? Does anyone know how the os x wheel-creating-script (
VTKPythonPackage/scripts/macos_build_wheels.py) decides on the directory structure?