Closed tkeskita closed 2 years ago
import vtk
does not seem to work in Blender 2.93 Python Console any more..? More information in discussion thread.
Well, I'm getting short on ideas. import vtk
works fine in Blender 2.92 Python Console, but fails in 2.93.x with this weird undefined symbol: Py_Main
error. Since error occurs only within Blender Python Console and works if called from Python interpreter, it feels like a Blender issue..
This is now a showstopper issue on Linux. import vtk
fails in Blender's Python Console. I've tested Ubuntu 20.04 and 21.10, and Blender versions 2.93.6 and 3.0.0. On Windows this issue doesn't exist. If anyone has some other Linux distro, please try and see does it work for you. Thanks!
I tried this with Ubuntu 20.04:
If you go to 2.93/python/lib/python3.9/site-packages/vtkmodules/all.py
and comment out line 44:
#from .vtkRenderingMatplotlib import *
ugly, but it seems to works for me. Tried it with 2.93 and a git master branch.
Thanks for this workaround! Somehow I managed not to think and try this previously myself. Since it's disabling only Matplotlib rendering, I think this is a tolerable workaround, until such a time as the precise reason for the failure is revealed. Thanks once again! Gonna proceed with testing further later on..
Glad I could help. It is only font rendering using Matplotlib, so I guess not an important loss. Also, the documentation states that importing all modules is not the recommended way anyway: https://vtk.org/doc/nightly/html/md__builds_gitlab_kitware_sciviz_ci_Documentation_Doxygen_PythonWrappers.html
Thanks for the link, good read. Replacing import vtk
with individual vtkmodules would help to get faster loading time, but there are >100 vtkmodules to pick from, so currently it seems best just to stick with import vtk
.
I wonder if there is a way to say import vtkmodules.all as vtk except vtkRenderingMatplotlib
in Python..
Anyways, tests pass nicely, so I'm gonna proceed with upgrading BVTKNodes to VTK 9.1.0, which is available now for Python 3.7 (Blender 2.83) and Python 3.9 (Blender 2.93 and 3.0). Using your workaround is fine for BVTKNodes.
Looks like there's many things changed in VTK 9.1 compared to 9.0, seems almost like a whole new major version. Need to debug and modify many things, also some customized nodes.. so this will likely take a while.
Quite painful upgrade, but should be now ready. Even CI errors seem to be now fixed.
Looks like VTK 9.0.1 is not available for Python 3.9 (in Blender 2.93), so it's about time to upgrade.