Ubuntu 18.04: SIP モジュール qgis をロードできませんでした

Ubuntu 18.04: SIP モジュール qgis をロードできませんでした

Ubuntu 18.4 に QGIS をインストールしようとしているので、次のリポジトリを追加しました:

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

最終的にソースを更新し、QGis をインストールしました。

sudo apt update
sudo apt install qgis

しかし、アプリケーションを実行すると次のエラーが発生しました:

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

アプリケーションを終了した後、次のエラーが発生しました:

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

答え1

私は自分の問題の解決策を見つけたので、私と同じ状況に陥っている人への質問に答えました。

によるとStack Overflowのこのページ:

PyPIのPyQtはインストールされたQtと互換性がありません

そこで、pip3 を使用して pyqt5 を削除しました。

pip3 uninstall PyQt5

aptからPyQt5をインストールしました:

sudo apt-get install python3-pyqt5

現在、Qgis は正常に動作しているようです。

答え2

私の場合は Manjaro / ArchLinux で動作します。

ではこのエラーが発生しないことに気付きましたsudo qgisが、ルートではなくホーム ディレクトリを使用したいので、これは良い解決策ではありません。権限とパスが何らかの理由で間違っていることを示唆しています。

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

これで、QGIS は Python を正常に起動します。

関連情報