8

I am trying to install QGIS on Ubuntu 18.4 so I added this repo:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update

Finally updated my sources and I installed QGis:

sudo apt update
sudo apt install qgis

but when running the application i got these errors:

groot@groot-Product:~$ qgis
"<font color=\"red\">Couldn't load SIP module.<br>Python support will be disabled.</font><br><pre><br>Traceback (most recent call last):<br>&nbsp; File \"<string>\", line 1, in <module><br>&nbsp; File \"/usr/lib/python3/dist-packages/qgis/__init__.py\", line 72, in <module><br>&nbsp; &nbsp; from qgis.PyQt import QtCore<br>&nbsp; File \"/usr/lib/python3/dist-packages/qgis/PyQt/QtCore.py\", line 26, in <module><br>&nbsp; &nbsp; from PyQt5.QtCore import *<br>ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.12' not found (required by /home/groot/.local/lib/python3.6/site-packages/PyQt5/QtCore.so)<br><br></pre>Python version:<br>3.6.7 (default, Oct 22 2018, 11:32:17) <br>[GCC 8.2.0]<br><br>QGIS version:<br>3.4.6-Madeira 'Madeira', exported<br><br>Python path:<br>['/usr/share/qgis/python', '/home/groot/.local/share/QGIS/QGIS3/profiles/default/python', '/home/groot/.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/groot/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']"
"<font color=\"red\">An error occurred during execution of following code:<br><tt>qgis.utils.uninstallErrorHook()</tt></font><br><pre><br>Traceback (most recent call last):<br>&nbsp; File \"<string>\", line 1, in <module><br>NameError: name 'qgis' is not defined<br><br></pre>Python version:<br>3.6.7 (default, Oct 22 2018, 11:32:17) <br>[GCC 8.2.0]<br><br>QGIS version:<br>3.4.6-Madeira 'Madeira', exported<br><br>Python path:<br>['/usr/share/qgis/python', '/home/groot/.local/share/QGIS/QGIS3/profiles/default/python', '/home/groot/.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/groot/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']"

And after I exit the application I got these error:

"<font color=\"red\">An error occurred during execution of following code:<br><tt>qgis.utils.uninstallErrorHook()</tt></font><br><pre><br>SystemError: PyEval_EvalCodeEx: NULL globals<br><br></pre>Python version:<br><br><br>QGIS version:<br>3.4.6-Madeira 'Madeira', exported<br><br>Python path:<br>"
groot@groot-Product:~$ 

2 Answers 2

12

I found a solution for my problem so i answered to my question to someone stuck in my situation:

According this page on Stack Overflow:

PyQt in PyPI is not compatible with the installed Qt

So I removed pyqt5 using pip3:

pip3 uninstall PyQt5

and installed PyQt5 from apt:

sudo apt-get install python3-pyqt5

Now Qgis seems to work correctly.

3
  • 1
    Wonderful! Finally, your solution worked for me, after weeks of looking. If anyone is wondering why they have a "permission denied" error, you might have to use sudo pip3 uninstall PyQt5. In my case, I didn't have to install python3-pyqt5, as I already had the latest version installed. Not sure if removing the pip3 version of PyQt5 broke anything on my system, but will make sure I let people know here.
    – stragu
    Commented Jun 26, 2019 at 23:53
  • make sure to run pip3 uninstall PyQt5 as a normal user not as root. Sometimes you will also have to uninstall it for older Python versions via pip3 uninstall PyQt5.
    – Bent
    Commented Nov 3, 2019 at 13:15
  • Thanks a lot! i solved my problem on Ubuntu 20.04 and QGIS "a coruña"
    – fccoelho
    Commented May 30, 2020 at 13:07
0

Works for me on Manjaro / ArchLinux.

I had noticed that I don't get this error with sudo qgis, but this isn't a good solution because I want to use my home directory, not root's. Hints that permissions and paths are off somehow.

pip uninstall PyQt5 # defaults to pip3
sudo pacman -S python-pyqt5 python-pyqt5-sip

Now QGIS launches python successfully.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .