I tried out a few things to try to sort out why it works for “vtkpython” but fails for “python”.
First, I stripped down “vtkpython” so that all it did was call Py_Main()
, just in case there was some magic happening in vtkPythonInterpreter. But even without the vtkPythonInterpreter stuff, PyQt + VTK worked fine.
Next, I downloaded the Python 3.7 source and built it myself. I targetted OS X 10.9, which is what the official binary package does. For this home-built python, PyQt + VTK still works fine.
Finally, I took just my home-built python executable, and copied it overtop of the official python3.7 executable. This also worked fine. So the issue is somehow with the shipped executable. Since the executable does nothing but call Py_Main()
, the problem must have to do with the way that OS X is loading the executable.
My executable is built with the 10.14 SDK, their executable is built with the 10.9 SDK. Both target 10.9. And both were using their framework libraries.
Also, my executable links to the CoreFoundation framework, and theirs does not. Not sure what caused this difference, or what the implications are.
And, finally, their executable is signed and mine is not. Pretty sure this is unrelated to the rendering problem.
Hopefully someone else can pick things up from here and figure out what is going on…
Edit: One final test. The official Python binary package provides a Python.app
with a Python.app/Contents/MacOS/Python
executable. The PyQT+VTK test fails with this executable. When I replaced this Python
with my home-built executable, PyQt+VTK works. This executable also links to CoreFoundation, and seems to differ from mine only in the SDK (10.9 vs 10.14) and the addition of a signature.