Saturday, 3 November 2018

Work around for “Couldn’t load PyQt” error with QGIS 3.0.3 on Ubuntu 18.04?


I am working with a fresh install of Ubuntu 18.04 and installed QGIS using https://qgis.org/debian. I get the following error when I launch QGIS:



Couldn't load PyQt.
Python support will be disabled.
Traceback (most recent call last):
File "", line 1, in
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.10' not found (required by /usr/local/lib/python3.6/dist-packages/PyQt5/QtCore.so)
Python version:
3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]

QGIS version:

3.0.3-Girona 'Girona', 8a899c8

Python path:
['/usr/share/qgis/python', '/home/ned/.local/share/QGIS/QGIS3/profiles/default/python', '/home/ned/.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', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

A similar error has been reported as a bug (https://issues.qgis.org/issues/19040) but I haven’t seen a workaround.


I tried to install 2.18 (ltr) but apt-get failed with:


qgis : Depends: python-qgis (= 1:2.18.20+28bionic) but 1:3.1.0+git20180529+ad1fef9+28bionic is to be installed

Any suggestions on how to get QGIS working on Ubuntu 18.04?




Answer



I was able to reproduce this error by installing PyQt5 using the Python package manager. If you remove the Python-managed PyQt5 and instead install the OS version, QGIS should launch. I have confirmed that an OS-managed PyQt5 is available on clean install of Ubuntu 18.04, and a/o June 1, 2018, both Ubuntu repositories and PyPI are providing PyQt 5.10.1.


Remove PyQt5 with:


sudo pip3 uninstall PyQt5

You can confirm that PyQt5 is available to the system Python with:


apt-cache policy python3-pyqt5

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...