Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore with QGIS 3.10.2 and Ubuntu 18.04 #34317

Closed
stragu opened this issue Feb 6, 2020 · 13 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers

Comments

@stragu
Copy link

stragu commented Feb 6, 2020

Using Ubuntu Studio 18.04 with the ubuntugis repos, when I start QGIS 3.10.2, I run into this issue:

Couldn't load PyQGIS.
Python support will be disabled.


Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/gui/__init__.py", line 25, in 
    from qgis._gui import *
RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore


Python version:
3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0]

QGIS version:
3.10.2-A Coruña 'A Coruña', 616ad4531b

Python path:
['/usr/share/qgis/python', '/home/stragu/.local/share/QGIS/QGIS3/profiles/default/python', '/home/stragu/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/stragu/.local/lib/python3.6/site-packages', '/home/stragu/software/reaper/src/socialreaper', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages']

Which results in QGIS without most of the processing tools.

I could find my Qt5 and PyQt5 version by running the following:

python3
from PyQt5.QtCore import QT_VERSION_STR
print("Qt version:", QT_VERSION_STR)
from PyQt5.Qt import PYQT_VERSION_STR
print("PyQt version:", PYQT_VERSION_STR)

I had 5.9.2 for the Qt version, and 5.9.1 for the PyQt version.

I also checked my version of libqt5core5a, and I had 5.9.5 installed.

So I thought I could try updating PyQt5 incrementally and see if that helped. You can check the history of releases of PyQt5 here: https://pypi.org/project/PyQt5/#history

I first tried:

pip3 install 'pyqt5==5.10.1'

But that led to more issues, as PyQt5 was obviously looking for Qt Core version 5.10 on my system. Upgrading Qt on the system seems like a bad, painful idea, so I decided to revert PyQt5 to the previous version. Turns out there was a more recent release in the 5.9 branch: I had 5.9.1 installed, but there is 5.9.2 available. I ran:

pip3 install 'pyqt5==5.9.2'

... to no avail, unfortunately. Back to the original issue.

(Also, sidenote: pip3 makes it looks like it sticks to the 5.10 branch. The commands:

pip3 list

and

pip3 list --user

... show that both the system and user modules have PyQt5 5.10.1

But going into a python3 kernel again, we can confirm that the version matches whatever we installed last. Phew, just a pip3 weirdness?)

Interestingly (?), the bionic repos have version 5.10.1 of pyqt5-dev available, which is not installed by default, but installing it doesn't change anything.

People having similar issues online:

I'm out of ideas here. Anything else I could try?

QGIS and OS versions

QGIS version 3.10.2-A Coruña QGIS code revision 616ad45
Compiled against Qt 5.9.5 Running against Qt 5.9.5
Compiled against GDAL/OGR 3.0.2 Running against GDAL/OGR 3.0.2
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
Compiled against SQLite 3.22.0 Running against SQLite 3.22.0
PostgreSQL Client Version 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1) SpatiaLite Version 4.3.0a
QWT Version 6.1.3 QScintilla2 Version 2.10.2
Compiled against PROJ 6.2.1 Running against PROJ Rel. 6.2.1, November 1st, 2019
OS Version Ubuntu 18.04.4 LTS
@stragu stragu added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Feb 6, 2020
@gioman
Copy link
Contributor

gioman commented Feb 6, 2020

with the ubuntugis repos

@stragu did you added the proper qgis.org repo (that uses ubuntugis dependencies)?

@gioman gioman added the Feedback Waiting on the submitter for answers label Feb 6, 2020
@stragu
Copy link
Author

stragu commented Feb 6, 2020 via email

@gioman
Copy link
Contributor

gioman commented Feb 8, 2020

Yes, using https://qgis.org/ubuntugis/

@stragu weird, many of us do installations on k/ubuntu, mint at al. and I personally don't see this problem/error. It could be a local issue, you can test it by trying the installation on Ubuntu Studio on VM for example.

@stragu
Copy link
Author

stragu commented Feb 9, 2020

Thanks, @gioman

After paying around with my PyQt5 version, I've got the following error:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/core/__init__.py", line 25, in 
    from qgis._core import *
ValueError: PyCapsule_GetPointer called with incorrect name

Which makes me think it has to be something like this one: #28362
(they witnessed the same two errors).

@stragu
Copy link
Author

stragu commented Feb 9, 2020

Hm interesting, I think I solved it by uninstalling PyQt5 and PyQt5-sip with pip3, I guess so QGIS would use my system packages instead?

I did the following in a terminal:

pip3 uninstall PyQt5-sip
pip3 uninstall PyQt5

And I can now start QGIS 3.10 without errors!

This is where I got the idea: https://tutel.me/c/gis/questions/306595/qgis+34+couldn39t+load+sip+module+python+support+will+be+disabled+on+windows+10

Does that make sense to you at all?

@stragu stragu closed this as completed Feb 9, 2020
@nyalldawson
Copy link
Collaborator

In general it's a really bad idea to install pyqt through pip -- you'll end up with a mess of conflicting qt versions on your system

@stragu
Copy link
Author

stragu commented Feb 10, 2020

Thank you, not sure how I started out with those installed through Pip, but glad it's working now.

Thanks again for your help, @nyalldawson and @gioman ! :)

@jmonticolo
Copy link
Contributor

RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore

For this error, I've just reinstalled PyQt5 QScintilla :

sudo apt reinstall python3-pyqt5.qsci

@rhabacker
Copy link

With qgis 3.32.0 on openSUSE Tumbleweed I also fixed this issue by installing PyQt5 QScintilla

sudo zypper install  python311-qscintilla-qt5 

@XianranZ
Copy link

Hm interesting, I think I solved it by uninstalling PyQt5 and PyQt5-sip with pip3, I guess so QGIS would use my system packages instead?

I did the following in a terminal:

pip3 uninstall PyQt5-sip
pip3 uninstall PyQt5

And I can now start QGIS 3.10 without errors!

This is where I got the idea: https://tutel.me/c/gis/questions/306595/qgis+34+couldn39t+load+sip+module+python+support+will+be+disabled+on+windows+10

Does that make sense to you at all?

I have the same error with you. After I uninstalled pyqt5 and pyqt5-sip, i got the error ' no module named pyqt5.core'. How can I solve it? Do you have any idea?

@XianranZ
Copy link

Os: redhat7.6
qgis: 3.28.14
QT: 5.14.2
PYQT: 5.14.2

@Gwing97
Copy link

Gwing97 commented Jan 29, 2024

Hm interesting, I think I solved it by uninstalling PyQt5 and PyQt5-sip with pip3, I guess so QGIS would use my system packages instead?
I did the following in a terminal:

pip3 uninstall PyQt5-sip
pip3 uninstall PyQt5

And I can now start QGIS 3.10 without errors!
This is where I got the idea: https://tutel.me/c/gis/questions/306595/qgis+34+couldn39t+load+sip+module+python+support+will+be+disabled+on+windows+10
Does that make sense to you at all?

I have the same error with you. After I uninstalled pyqt5 and pyqt5-sip, i got the error ' no module named pyqt5.core'. How can I solve it? Do you have any idea?

Me too. I have same problem. But don't know how to do.

@XianranZ
Copy link

XianranZ commented Feb 1, 2024

Hm interesting, I think I solved it by uninstalling PyQt5 and PyQt5-sip with pip3, I guess so QGIS would use my system packages instead?
I did the following in a terminal:

pip3 uninstall PyQt5-sip
pip3 uninstall PyQt5

And I can now start QGIS 3.10 without errors!
This is where I got the idea: https://tutel.me/c/gis/questions/306595/qgis+34+couldn39t+load+sip+module+python+support+will+be+disabled+on+windows+10
Does that make sense to you at all?

I have the same error with you. After I uninstalled pyqt5 and pyqt5-sip, i got the error ' no module named pyqt5.core'. How can I solve it? Do you have any idea?

Me too. I have same problem. But don't know how to do.

I reinstalled qgis and all it's dependencies on a new machine and then the problem was solved. I don't know if this will solve your problem, but I hope my answer will help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers
Projects
None yet
Development

No branches or pull requests

7 participants