enthought / enable

Enable: low-level drawing and interaction
Other
91 stars 45 forks source link

AttributeError: module 'pyface.qt.QtSvg' has no attribute 'QSvgWidget' when running enable/enable/examples/demo/savage/static_image.py for python3.11 #1020

Closed homosapien-lcy closed 1 year ago

homosapien-lcy commented 1 year ago

AttributeError: module 'pyface.qt.QtSvg' has no attribute 'QSvgWidget' when python enable/enable/examples/demo/savage/static_image.py

environment: [macOS, python3.11, python3.8 with or without EDM]

Package lists:

# Packages in environment 'test_edm_py38'
#  prefix: '/Users/cyliu/.edm/envs/test_edm_py38'
chaco                5.1.1-1        enthought/free
configobj            5.0.6.post9-1  enthought/free
enable               5.3.1-5        enthought/free
fonttools            4.31.1-1       enthought/free
importlib_resources  5.4.0-1        enthought/free
intel_openmp         2021.4.28-1    enthought/free
joblib               1.1.0-1        enthought/free
libfreetype          2.12.1-1       enthought/free
libharfbuzz          3.2.0-4        enthought/free
libicu               70.1-2         enthought/free
liblcms2             2.12-1         enthought/free
libopenjpeg          2.4.0.post1-1  enthought/free
libpng               1.6.37-100     enthought/free
libtiff              4.3.0-2        enthought/free
libturbojpeg         2.1.2-1        enthought/free
libzstd              1.5.0-1        enthought/free
mkl                  2021.3.0-1     enthought/free
mkl_service          2.4.0-1        enthought/free
numpy                1.21.2-2       enthought/free
pandas               1.3.2-2        enthought/free
pillow_simd          9.0.0.post1-2  enthought/free
pip                  22.2.2-1       enthought/free
pyface               7.4.4-2        enthought/free
pygments             2.8.1-1        enthought/free
pyparsing            2.4.7-3        enthought/free
pyside6              6.2.3-6        enthought/lgpl
python_dateutil      2.8.2-1        enthought/free
pytz                 2022.6-1       enthought/free
qtbase               6.2.3-3        enthought/lgpl
qtdeclarative        6.2.3-2        enthought/lgpl
qtmultimedia         6.2.3-3        enthought/lgpl
qtshadertools        6.2.3-2        enthought/lgpl
qtsvg                6.2.3-2        enthought/lgpl
qttools              6.2.3-3        enthought/lgpl
scikit_learn         1.0.2-2        enthought/free
scipy                1.8.0-1        enthought/free
setuptools           67.4.0-1       enthought/free
shiboken6            6.2.3-4        enthought/lgpl
six                  1.16.0-1       enthought/free
threadpoolctl        3.1.0-2        enthought/free
traits               6.4.1-1        enthought/free
traitsui             7.4.3-1        enthought/free
zipp                 3.7.0-1        enthought/free
mdickinson commented 1 year ago

@homosapien-lcy Please can you give some more context? What Python version? What OS? Most importantly, what packages are installed, and what Qt backend are you using? (PySide6? PyQt6? Something else?)

In general, whenever you're reporting a Python error, it's good practice also to include the entire traceback.

Do you have any thoughts about what might be going wrong here, and how to fix it?

homosapien-lcy commented 1 year ago

Got it, I just updated the package informations. I think maybe the function its looking for has moved to another module. We probably need to search for it.

mdickinson commented 1 year ago

Okay, so this is PySide6. See the docs here: https://doc.qt.io/qtforpython/PySide6/QtSvgWidgets/QSvgWidget.html. QSvgWidget should now be imported from QtSvgWidgets instead of from QtSvg.

However, that doesn't necessarily mean that the right fix is to change the imports here, since we still want this example to work with backends other than PySide6. Pyface should be providing us with a backend-independent way for us to get QSvgWidget, so that downstream code can use that regardless of which Qt backend is in use. Please could you open a Pyface issue for this, if necessary?

homosapien-lcy commented 1 year ago

Okay, so this is PySide6. See the docs here: https://doc.qt.io/qtforpython/PySide6/QtSvgWidgets/QSvgWidget.html. QSvgWidget should now be imported from QtSvgWidgets instead of from QtSvg.

However, that doesn't necessarily mean that the right fix is to change the imports here, since we still want this example to work with backends other than PySide6. Pyface should be providing us with a backend-independent way for us to get QSvgWidget, so that downstream code can use that regardless of which Qt backend is in use. Please could you open a Pyface issue for this, if necessary?

Got it, I also open this issue in pyface (https://app.zenhub.com/workspaces/ets-queue-priority-64022b3641e35b00166c1272/issues/gh/enthought/pyface/1235) besides making the quick fix.

mdickinson commented 1 year ago

Thanks! As mentioned before, it's better to use a direct link to other issues, since (a) not everyone viewing this tracker will have zenhub access, and (b) GitHub will create a reverse link on the Pyface issue.

So use: https://github.com/enthought/pyface/issues/1235 instead of the ZenHub URL.