examples/mayavi/interactive/coil_design_application.py fails: No module named 'traitsui.qt4.editor'
yurivict opened this issue · 1 comments
yurivict commented
Qt5 is now used. Qt5 has been long retired.
/usr/ports/graphics/py-mayavi/work-py39/stage/usr/local/lib/python3.9/site-packages/tvtk/pyface/ui/qt4/scene_editor.py:16: FutureWarning: The traitsui.qt4.* modules have moved to traitsui.qt.*.
Applications which require backwards compatibility can either:
- set the ETS_QT4_IMPORTS environment variable
- set the ETS_TOOLKIT environment variable to "qt4",
- the ETSConfig.toolkit to "qt4"
- install a ShadowedModuleFinder into sys.meta_path::
import sys
from pyface.ui import ShadowedModuleFinder
sys.meta_path.append(ShadowedModuleFinder(
package="traitsui.qt4.",
true_package="traitsui.qt.",
))
from traitsui.qt4.editor import Editor
Traceback (most recent call last):
File "/usr/ports/graphics/py-mayavi/work-py39/mayavi-4.8.1/examples/mayavi/interactive/coil_design_application.py", line 45, in <module>
from mayavi.core.ui.api import EngineView, MlabSceneModel, \
File "/usr/ports/graphics/py-mayavi/work-py39/stage/usr/local/lib/python3.9/site-packages/mayavi/core/ui/api.py", line 4, in <module>
from tvtk.pyface.scene_editor import SceneEditor
File "/usr/ports/graphics/py-mayavi/work-py39/stage/usr/local/lib/python3.9/site-packages/tvtk/pyface/scene_editor.py", line 12, in <module>
SceneEditor = toolkit_object('scene_editor:SceneEditor')
File "/usr/local/lib/python3.9/site-packages/pyface/base_toolkit.py", line 127, in __call__
module = import_module(mname, package)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/ports/graphics/py-mayavi/work-py39/stage/usr/local/lib/python3.9/site-packages/tvtk/pyface/ui/qt4/scene_editor.py", line 16, in <module>
from traitsui.qt4.editor import Editor
ModuleNotFoundError: No module named 'traitsui.qt4.editor'
*** Error code 1
Version: 4.8.1
Python-3.9
FreeBSD 13.2
corranwebster commented
If you read the error message you will see several work-arounds that you can use until Mayavi is updated.
The "qt4" is misleading - it is referring to a poorly-named pyface/traitsui subpackage that dates back to Qt4, but works with PyQt5 and PySide2/6.