Python 3.11 Windows - builds and runs OK

I just built VTK (master) with Python 3.11 in Windows with no problems.Thanks to those involved in making sure everything works @ben.boeckel @dgobbi and any others. Also tested using a few VTK Examples. Is it my imagination but both Python 3.11 and 3.10 seem faster than earlier versions of Python wrt VTK?

1 Like

Nothing specific has been done to make the wrappers faster for these versions of Python, so you’re probably just seeing improvements in Python itself (the wrappers make heavy use of dicts and tuples).

Once our minimum supported version is Python 3.8, we might switch over to the “vectorcall” protocol for the wrappers, and that should provide some speed improvements.

Note that official support via PyPI is blocked on deps not providing wheels: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9588

Did you build the exact same source against earlier Python versions? It might be changes in VTK which are making the difference.

Yes, if you look at the pipeline the problem is that our “relocatable Python” bundles on macOS are not fully relocated and still expect to live in /Library/Frameworks and fails to compile dependencies not available. Linux and Windows work because the Python SDKs work from pip in CI.

I’m not sure if this will affect Python wheels but while setting up virtual environments I noticed a couple of warnings about a missing pyproject.toml and falling back to setup.py. I looked at a vtk-9.2.2 wheel but couldn’t find a pyproject.toml or setup.py so I assume everyything will be OK for those who build a VTK wheel.

I’m pretty ignorant in this area!

Links to PEPs for what is being complained about would be very helpful. A setup.py isn’t going to be very useful and I suspect pyproject.toml is even more primitive and therefore useless for a VTK wheel (if it is complaining to the effect of “cannot be rebuilt on a platform that it isn’t built for”).

@ben This is a result of adding Sphinx to my VTK venv as it is also used for building CMake. This was the warning in relation to MarkupSafe; it was one of the collected packages needed by MarkupSafe:

 DEPRECATION: MarkupSafe is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

That link then references PEP 517 and that link in turn refrences PEP 518 that details the pyproject.toml reasoning.

FYI here is what I do for setting up my VTK venv:

py -m venv %USERPROFILE%\venv\VTK
%USERPROFILE%\venv\VTK\scripts\activate
python -m pip install --upgrade pip
pip install Sphinx numpy matplotlib setuptools
deactivate

VTK doesn’t provide an sdist, so this seems moot for it. MarkupSafe seems to be the problem package here.