gltn / stdm

STDM is a free and open source pro-poor land recordation system based on QGIS, PostgreSQL and PostGIS.
http://stdm.gltn.net/
GNU General Public License v2.0
30 stars 30 forks source link

Stack trace: ImportError: cannot import name 'QgsDateEdit' from 'qgis.gui' #455

Closed wondie closed 3 years ago

wondie commented 3 years ago

When I started QGIS 3.16.4 using STDM 1.8, I got a stack trace that says:

Couldn't load plugin 'stdm' due to an error when calling its classFactory() method 
ImportError: cannot import name 'QgsDateEdit' from 'qgis.gui' (C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\gui\__init__.py) 
Traceback (most recent call last):
  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\stdm\__init__.py", line 146, in classFactory
    from stdm.plugin import STDMQGISLoader
  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\stdm\plugin.py", line 107, in 
    from stdm.ui.doc_generator_dlg import (
  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\stdm\ui\doc_generator_dlg.py", line 48, in 
    from stdm.composer.document_generator import DocumentGenerator
  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\stdm\composer\document_generator.py", line 71, in 
    from stdm.ui.forms.widgets import EntityValueFormatter
  File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\stdm\ui\forms\widgets.py", line 43, in 
    from qgis.gui import (
ImportError: cannot import name 'QgsDateEdit' from 'qgis.gui' (C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\gui\__init__.py)

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] 
QGIS version: 3.10.4-A Coruña A Coruña, 10bc9f2ff2 

Python Path:
C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python
C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS3~1.10\apps\Python37
C:\PROGRA~1\QGIS3~1.10\apps\Python37\Scripts
C:\Program Files\QGIS 3.10\bin\python37.zip
C:\PROGRA~1\QGIS3~1.10\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib
C:\Program Files\QGIS 3.10\bin
C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\site-packages
C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\site-packages\Pythonwin
C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/wondim/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64
C:\Users\wondim\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\stdm\third_party
C:\Users\wondim\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\stdm\third_party\FontTools
gkahiu commented 3 years ago

This is an issue with your QGIS version as QgsDateEdit was introduced in v3.14 (see ref here). Hence, kindly update your QGIS to v3.14+.

I have also updated the qgisMinimumVersion flag in the metadata file to avoid using a lower version in future.

wondie commented 3 years ago

The version is 3.16.4 though. image

gkahiu commented 3 years ago

The error indicates that you are running QGIS 3.10:

image

Perhaps you have two versions?

wondie commented 3 years ago

I guess I did an update and it didn't update correctly.