Ubuntu 18.04: Não foi possível carregar o módulo SIP qgis

Ubuntu 18.04: Não foi possível carregar o módulo SIP qgis

Estou tentando instalar o QGIS no Ubuntu 18.4, então adicionei este repositório:

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

Finalmente atualizei minhas fontes e instalei o QGis:

sudo apt update
sudo apt install qgis

mas ao executar o aplicativo recebi estes erros:

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']"

E depois de sair do aplicativo recebi este erro:

"<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:~$ 

Responder1

Encontrei uma solução para o meu problema, então respondi à minha pergunta para alguém preso na minha situação:

De acordo comesta página no Stack Overflow:

PyQt em PyPI não é compatível com o Qt instalado

Então removi o pyqt5 usando pip3:

pip3 uninstall PyQt5

e instalei o PyQt5 do apt:

sudo apt-get install python3-pyqt5

Agora o Qgis parece funcionar corretamente.

Responder2

Funciona para mim no Manjaro/ArchLinux.

Percebi que não recebo esse erro sudo qgis, mas essa não é uma boa solução porque quero usar meu diretório inicial, não o root. Sugere que as permissões e os caminhos estão desativados de alguma forma.

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

Agora o QGIS lança o python com sucesso.

informação relacionada