Bug report #20443

Python error on QGIS GUI startup

Added by Mohamed Laradji about 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:GUI
Affected QGIS version:3.4.1 Regression?:No
Operating System:Ubuntu 18.04.1 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:28263

Description

I have installed qgis in Kubuntu Desktop through

aptitude install qgis python-qgis qgis-plugin-grass

The installation finishes without problems. When running the application, I get the following error in a window titled "Python error":

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 27, in
from qgis._gui import *
RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore

After closing that window, another window shows up, titled "Python error" and has the text

An error occurred during execution of following code:
qgis.utils.uninstallErrorHook()

Traceback (most recent call last):
File "", line 1, in
NameError: name 'qgis' is not defined

Python version:
3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

QGIS version:
3.4.1-Madeira 'Madeira', 383851c

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

Upon closing this window, the QGIS window appears without any other issues. I assume, however, that Python functionality would be disabled.

My suspicion is that this is not a bug with QGIS, but rather the result of some corrupted packages on my system. I am curious to see if any other users face a similar issue.

History

#1 Updated by Mohamed Laradji about 6 years ago

The installed qgis packages on my system are:

ii libqgis-3d3.4.1 1:3.4.1+28bionic amd64 QGIS - shared 3d library
ii libqgis-analysis3.4.1 1:3.4.1+28bionic amd64 QGIS - shared analysis library
ii libqgis-app3.4.1 1:3.4.1+28bionic amd64 QGIS - shared app library
ii libqgis-core3.4.1 1:3.4.1+28bionic amd64 QGIS - shared core library
ii libqgis-customwidgets 1:3.4.1+28bionic amd64 QGIS custom widgets for Qt Designer
ii libqgis-gui3.4.1 1:3.4.1+28bionic amd64 QGIS - shared gui library
ii libqgis-native3.4.1 1:3.4.1+28bionic amd64 QGIS - shared native gui library
ii libqgis-server3.4.1 1:3.4.1+28bionic amd64 QGIS - shared server library
ii libqgisgrass7-3.4.1 1:3.4.1+28bionic amd64 QGIS - shared grass library
ii libqgispython3.4.1 1:3.4.1+28bionic amd64 QGIS - shared Python library
ii python-qgis 1:3.4.1+28bionic amd64 Python bindings to QGIS
ii python-qgis-common 1:3.4.1+28bionic all Python bindings to QGIS - architecture-independent files
ii qgis 1:3.4.1+28bionic amd64 Geographic Information System (GIS)
ii qgis-common 1:3.4.1+28bionic all QGIS - architecture-independent data
ii qgis-plugin-grass 1:3.4.1+28bionic amd64 GRASS plugin for QGIS
ii qgis-plugin-grass-common 1:3.4.1+28bionic all GRASS plugin for QGIS - architecture-independent data
ii qgis-provider-grass 1:3.4.1+28bionic amd64 GRASS provider for QGIS
ii qgis-providers 1:3.4.1+28bionic amd64 collection of data providers to QGIS
ii qgis-providers-common 1:3.4.1+28bionic all collection of data providers to QGIS - architecture-independent files

#2 Updated by Giovanni Manghi about 6 years ago

  • Status changed from Open to Feedback

Try cleaning your qgis system folders, I use Kubuntu 18.04 here and no such issue.

#3 Updated by Flavio D'Oliveira about 6 years ago

I got the same error. I use Ubuntu 18.04.
I don't know why because I used Qgis wien before and never got that error msg.
I'm looking for fixing ideas, but it seems that no one knows how to solve..

#4 Updated by Mohamed Laradji about 6 years ago

Giovanni Manghi wrote:

Try cleaning your qgis system folders, I use Kubuntu 18.04 here and no such issue.

Thank you for your reply.

I've tried purging all the qgis packages through `aptitude purge "~i qgis"` (including deleting any files found through `locate qgis` from the system) and reinstalling through `aptitude install qgis python-qgis qgis-plugin-grass`, with no luck.

Perhaps its a compatibility issue? Executing `import qgis` via `/usr/bin/python3` produces the following output:

Python 3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.

import qgis

Cannot mix incompatible Qt library (version 0x50905) with this library (version 0x50903)
Aborted (core dumped)

#5 Updated by Flavio D'Oliveira about 6 years ago

Mohamed Laradji wrote:

Giovanni Manghi wrote:

Try cleaning your qgis system folders, I use Kubuntu 18.04 here and no such issue.

Thank you for your reply.

I've tried purging all the qgis packages through `aptitude purge "~i qgis"` (including deleting any files found through `locate qgis` from the system) and reinstalling through `aptitude install qgis python-qgis qgis-plugin-grass`, with no luck.

Perhaps its a compatibility issue? Executing `import qgis` via `/usr/bin/python3` produces the following output:

Python 3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.

import qgis

Cannot mix incompatible Qt library (version 0x50905) with this library (version 0x50903)
Aborted (core dumped)

SOLVED!
I'm using Ubuntu 18.04 and I did this:

Try to:
sudo apt-get remove qgis python-qgis

and then try to:
sudo apt-get install qgis python-qgis qgis-plugin-grass

#6 Updated by Giovanni Manghi about 6 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

Also available in: Atom PDF