I have QGIS 3.28.7 installed on my computer and in its Python Console this command works:

from qgis.gui import *

I tried to use it in some Python IDE's. For example, in Spyder. The following paths are defined in Tools\Python Manager:

C:\Program Files\QGIS 3.28.7\apps\qgis-ltr\bin
C:\Program Files\QGIS 3.28.7\apps\Qt5\plugins
C:\Program Files\QGIS 3.28.7\apps\Python39\Scripts
C:\Program Files\QGIS 3.28.7\apps\Qt5\bin
C:\Program Files\QGIS 3.28.7\bin
C:\Program Files\QGIS 3.28.7\apps\qgis-ltr\python
C:\Program Files\QGIS 3.28.7\apps\Python39

When I try in the Spyder panel:

from qgis.gui import *

I receive there the following message:

File C:\Program Files\QGIS 3.28.7\apps\qgis-ltr\python\qgis\gui\__init__.py:25
from qgis._gui import *
ImportError: DLL load failed while importing _gui: The specified procedure could not be found.

So what is the right way to solve the problem?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.