1

I am trying to get the pyqgis working with the Spyder installed as part of Anaconda. I first get the path to pyqgis and dependent packages from qgis console, typing:

import sys

sys.path

After that I add the path outputted by this command in sys.path within spyder:

sys.path.extend(['my/path/list']).

After this, I can import qgis.core, but while importing qgis.gui, it gives and error saying "RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore"

From within the qgis console everything works fine.

The spefications of my system are:
Operating system: Ubuntu (18.04 bionic) on Windows 10. For GUI I use VcXsrv X Server.
Python version: 3.7.2
PyQt5 version in Spyder: 5.9.2
QGIS version: 3.6

I thought it is, maybe, related to the version of PyQt5 that I use in Spyder. In Spyder it is 5.9.2, whereas in QGIS it is 5.10.1. However, installing newer version (5.12.1) of PyQt5 the problem did not solve, instead qgis.core also stopped importing. When I try to import qgis.core, python interpreter crashes saying "Segmentation fault (core dumped)".

What could be the problem here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.