#67842 closed defect (fixed)

Qgis3 - problems with some plugin

Reported by: news24lor Owned by: Veence (Vincent)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: nilason (Nicklas Larsson)
Port: qgis3

Description

Hello

I would like to report some probelms I have encountered in QGIS3 with some widely used plugins. QGIS3 works very well in general and many plugins work without problems but some very popular ones do not load at startup with an error indication that links to python modules that I cannot find in macports.

One plugin that does not load is "Data Plotly," a fantastic plugin that allows you to graph data. The error message is this:

Couldn't load plugin 'DataPlotly' due to an error when calling its classFactory() method 

ModuleNotFoundError: No module named 'PyQt5.QtWebKit' 
Traceback (most recent call last):
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/ben/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/__init__.py", line 33, in classFactory
    from .data_plotly import DataPlotly

.......

ModuleNotFoundError: No module named 'PyQt5.QtWebKit'

The PyQt5-qtwebkit module I could not find in macports.

The other plugin that does not load is "Spatial Analysis Toolbox" and the error is:

Couldn't load plugin 'spatialanalysistoolbox' due to an error when calling its classFactory() method 


ModuleNotFoundError: No module named 'mgwr' 
Traceback (most recent call last):
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/ben/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/spatialanalysistoolbox/__init__.py", line 36, in classFactory
    from .spatialanalysistoolbox import SpatialAnalysisToolboxPlugin
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

.......

ModuleNotFoundError: No module named 'mgwr'

Where is "mgr"?

Is it possible to find these modules in MacPorts?

Thanks

Lorenzo

Change History (14)

comment:1 Changed 16 months ago by jmroot (Joshua Root)

Cc: nilason added
Owner: set to Veence
Status: newassigned

comment:2 in reply to:  description Changed 15 months ago by nilason (Nicklas Larsson)

Replying to news24lor:

Hello

I would like to report some probelms I have encountered in QGIS3 with some widely used plugins. QGIS3 works very well in general and many plugins work without problems but some very popular ones do not load at startup with an error indication that links to python modules that I cannot find in macports.

Qt WebKit has been deprecated and finally removed with Qt 5.6 https://wiki.qt.io/New_Features_in_Qt_5.6#Removed_Modules, Qt5 on MacPorts is now at version 5.15.

May I suggest you file a ticket at https://github.com/ghtmtt/DataPlotly to perhaps adopt the code to use QtWebEngineWidgets (if I'm not mistaken) https://www.riverbankcomputing.com/software/pyqtwebengine.

The other plugin that does not load is "Spatial Analysis Toolbox" and the error is:

Couldn't load plugin 'spatialanalysistoolbox' due to an error when calling its classFactory() method 


ModuleNotFoundError: No module named 'mgwr' 
Traceback (most recent call last):
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/ben/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/spatialanalysistoolbox/__init__.py", line 36, in classFactory
    from .spatialanalysistoolbox import SpatialAnalysisToolboxPlugin
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)

.......

ModuleNotFoundError: No module named 'mgwr'

Where is "mgr"?

Is it possible to find these modules in MacPorts?

mgwr is/was part of py-pysal which is now pretty outdated on MacPorts. I have an update prepared, but before I can make a PR a number of outdated and non-existing ports need to be accepted and added.

comment:3 Changed 15 months ago by nilason (Nicklas Larsson)

There IS actually a possibility to install PyQt5.QtWebKit with the added non-default variant, e.g. py311-pyqt5 +webkit.

I have not been able to test that, as I run into build errors Project ERROR: Could not resolve SDK Path for 'macosx12.3' using --show-sdk-path ...

comment:4 Changed 15 months ago by news24lor

Hi Nicklas.

You wrote:

Qt WebKit has been deprecated and finally removed with Qt 5.6 ​https://wiki.qt.io/New_Features_in_Qt_5.6#Removed_Modules, Qt5 on MacPorts is now at version 5.15.

May I suggest you file a ticket at ​https://github.com/ghtmtt/DataPlotly to perhaps adopt the code to use QtWebEngineWidgets (if I'm not mistaken) ​https://www.riverbankcomputing.com/software/pyqtwebengine.

I will done.

I will try the variant py311-pyqt5+WebKit

Thanks for all

Lorenzo

comment:5 Changed 15 months ago by nilason (Nicklas Larsson)

py-mgwr is now available as part of py-pysal, please try and report back!

Last edited 15 months ago by nilason (Nicklas Larsson) (previous) (diff)

comment:6 Changed 15 months ago by news24lor

Hi Nicklas

I installed "mgwr" with some difficulty because many dependencies had to be installed with "port -f activate" but I succeeded.

Now the "Spatial Analysis Toolbox" plugin works natively.

Fantastic!

Thank you

Now there is only the problem of "Qt WebKit" which as you said is deprecated in the new versions of Qt replaced by "Qt WebEngine":

https://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html

but still the "DataPlotly" plugin uses it because the code is always there and "Qt WebKit" is within the officially distributed versions of QGIS. Several tickets are needed.

Anyway Thanks

Lorenzo

Last edited 15 months ago by news24lor (previous) (diff)

comment:7 Changed 15 months ago by nilason (Nicklas Larsson)

In c84eeb961ca19246df25462852fe1d521e81de80/macports-ports (master):

qgis3[-ltr]: new default variant for better support of plugins

See #67842
See #68016

comment:8 Changed 14 months ago by nilason (Nicklas Larsson)

Lorenzo,

there was a bug in the 'py-pyqt5' Portfile, which has now been fixed. Please try again with py311-pyqt5 +webkit.

comment:9 Changed 14 months ago by news24lor

Hi Nicklas

I reinstalled 'py311-pyqt5 +webkit' but when I open QGIS the 'DataPlotly' plugin error remains:

Couldn't load plugin 'DataPlotly' due to an error when calling its classFactory() method 

ModuleNotFoundError: No module named 'PyQt5.QtWebKit' 
Traceback (most recent call last):
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lorenzo/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/__init__.py", line 33, in classFactory
    from .data_plotly import DataPlotly
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lorenzo/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/data_plotly.py", line 32, in 
    from DataPlotly.gui.dock import DataPlotlyDockManager
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lorenzo/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/gui/dock.py", line 19, in 
    from DataPlotly.gui.plot_settings_widget import DataPlotlyPanelWidget
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lorenzo/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/gui/plot_settings_widget.py", line 49, in 
    from qgis.PyQt.QtWebKit import QWebSettings
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/PyQt/QtWebKit.py", line 24, in 
    from PyQt5.QtWebKit import *
  File "/Applications/MacPorts/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'PyQt5.QtWebKit'

Python version: 3.11.5 (main, Aug 27 2023, 16:04:19) [Clang 14.0.3 (clang-1403.0.22.14.1)] 
QGIS version: 3.32.2-Lima Lima, exported 

It is very difficult to align the Python modules of QGIS plugins with the modules installed by MacPorts. For example, another plugin does not load because it needs NumPy version 1.24 or lower while MacPorts has 1.25. As for QtWebKit which is obsolete for Qt but still present in the QGIS code and also used by other plugins.

Thanks

comment:10 in reply to:  9 ; Changed 14 months ago by nilason (Nicklas Larsson)

Replying to news24lor:

I reinstalled 'py311-pyqt5 +webkit' but when I open QGIS the 'DataPlotly' plugin error remains:

You probably need to update the "port tree" locally with sudo port selfupdate and only then (re-)install py311-pyqt5 +webkit.

It is very difficult to align the Python modules of QGIS plugins with the modules installed by MacPorts. For example, another plugin does not load because it needs NumPy version 1.24 or lower while MacPorts has 1.25. As for QtWebKit which is obsolete for Qt but still present in the QGIS code and also used by other plugins.

Well, this is both the strength and (sometimes) limitation of MP, it generally offers the latest stable version of a given piece of software. If a problem occurs with an update of a port, say QGIS itself, it may be patched by MP and the issue is usually reported upstreams. The plugins, however, is a quite different issue, it is virtually impossible to monitor and track them. The "webkit" problem (besides from not being installed by default) stemmed from a MP bug, which is now fixed. Issues like the incompatible numpy version you mentioned, must be reported upstreams (there is probably a trivial fix for that, the authors have likely not bumped into this yet as they apparently don't use MP :).

comment:11 in reply to:  10 Changed 14 months ago by news24lor

Replying to nilason:

You probably need to update the "port tree" locally with sudo port selfupdate and only then (re-)install py311-pyqt5 +webkit.

Yes I have rebuilt all and now DataPlotly works! Fantastic. Very good!

It's a bit difficult to install py311-plotly but it works!

Many many thanks!

It is very difficult to align the Python modules of QGIS plugins with the modules installed by MacPorts. For example, another plugin does not load because it needs NumPy version 1.24 or lower while MacPorts has 1.25. As for QtWebKit which is obsolete for Qt but still present in the QGIS code and also used by other plugins.

Well, this is both the strength and (sometimes) limitation of MP, it generally offers the latest stable version of a given piece of software. If a problem occurs with an update of a port, say QGIS itself, it may be patched by MP and the issue is usually reported upstreams. The plugins, however, is a quite different issue, it is virtually impossible to monitor and track them. The "webkit" problem (besides from not being installed by default) stemmed from a MP bug, which is now fixed. Issues like the incompatible numpy version you mentioned, must be reported upstreams (there is probably a trivial fix for that, the authors have likely not bumped into this yet as they apparently don't use MP :).

Now I try other important plugin.

Thanks a lot

comment:12 in reply to:  9 ; Changed 14 months ago by nilason (Nicklas Larsson)

Replying to news24lor:

For example, another plugin does not load because it needs NumPy version 1.24 or lower while MacPorts has 1.25.

Just tested the "spatialanalysistoolbox" and I now understand your problem with numpy. It was caused by failure of numba (!] to load numpy. Will be fixed by next numba release (see https://trac.macports.org/ticket/68159).

comment:13 in reply to:  12 Changed 14 months ago by news24lor

Replying to nilason:

Replying to news24lor:

For example, another plugin does not load because it needs NumPy version 1.24 or lower while MacPorts has 1.25.

Just tested the "spatialanalysistoolbox" and I now understand your problem with numpy. It was caused by failure of numba (!] to load numpy. Will be fixed by next numba release (see https://trac.macports.org/ticket/68159).

Yes It's a failure from Numba...

Until now, all the plugins that I use work!

And they are very fast under M1/M2 processor.

Fantastic.

Many many thanks.

comment:14 Changed 14 months ago by nilason (Nicklas Larsson)

Resolution: fixed
Status: assignedclosed

In 41a01a9fd31253c141116fb167416b64a478fecb/macports-ports (master):

qgis3[-ltr]: general overhaul and bug fixes

Notable changes:

  • Find out path to "mpi.h" for building against 'gdal +hdf5' (and remove mpi port group dependence)
  • Prettify PostgreSQL variant descriptions by removing dot in versions 10+
  • Fix flawed implementation of the +python_support variant
  • Fix failure to install grass dependency
  • Add note on plugin "missing PyQt5.QtWebKit module" error warning

Closes: #67842
See: #68006
Closes: #68016
Closes: #68081

Note: See TracTickets for help on using tickets.