1

When trying to compile the latest version of QGIS ( https://github.com/qgis/QGIS ) I end up with the folowing erros on cmake-gui:

Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindPyQt5.py", line 34, in <module>
    import PyQt5.pyqtconfig
ImportError: No module named 'PyQt5.pyqtconfig'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindPyQt5.py", line 37, in <module>
    import PyQt5.QtCore
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

Found SIP version: 4.17
Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindQsci.py", line 45, in <module>
    from PyQt5.Qsci import QSCINTILLA_VERSION_STR
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

Here is my python3 --version:

Python 3.5.2

I installed PyQt5 and other Python3 packages through pip3 to have the latest (in /usr/local).

Here are all the qt related packages $ pip3 list | grep -i qt:

PyQt5                         5.11.2                
PyQt5-sip                     4.19.12               
PyQtChart                     5.11.2                
QtAwesome                     0.4.4                 
qtconsole                     4.3.1                 
QtPy                          1.3.1  

Installation instructions can be found here: https://github.com/qgis/QGIS/blob/master/INSTALL

My OS is Ubuntu 16.04; uname -mor:

4.15.0-29-generic x86_64 GNU/Linux

The same error message appears if I simply run a python3 console and try to import Qsci from PyQt5 for example:

>>> from PyQt5 import Qsci
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

For the first error, which is lightly different, it seems the same as: qgis ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

swiss_knight
  • 5,787
  • 8
  • 50
  • 92

1 Answers1

1

For the second error, the solution I found, it is changing python version from 3.5 to 3.6, The mention in this documentation PyQt should work with python3.5 but it still gives me the error ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices. So, try to run the code with python3.6

Zaher88abd
  • 448
  • 7
  • 20
  • Qgis can't start with Python enabled if Python3.6 is used: `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.11' not found (required by /usr/local/lib/python3.6/dist-packages/PyQt5/QtCore.so) Python version: 3.6.3 (default, Oct 4 2017, 02:55:45) [GCC 5.4.0 20160609] ` – swiss_knight Aug 10 '18 at 10:05
  • It's probably a Qt related issue (?); trying to upgrade Qt to 5.11 is not straightforward: https://askubuntu.com/questions/1064117/unable-to-install-qt511-meta-full-from-ppabeineri-on-ubuntu-16-04-qt511doc-pac – swiss_knight Aug 10 '18 at 10:41
  • Mine worked by using python 3.10 instead of 3.9 – user14773854 Jan 25 '22 at 17:03