The problem:
Now that the compilation issue is over (Unable to compile QGIS 3.x (master) on Ubuntu 16.04: PyQt5.pyqtconfig module does not exist), QGIS 3 (master) refuses to load Python at startup.
I am working on Ubuntu 16.04 (4.15.0-30-generic x86_64 GNU/Linux).
- Python3
version is 3.5.2
- PyQt5
is 5.10.1
- SIP
is 4.19.12
(manually installed, detected version during the compilation is 4.19.12
, but sip.SIP_VERSION_STR when imported directly in a python3.5 console is 4.19.8
. I cannot understand why)
- QScintilla
is 2.10.4
These packages have been dowgraded as explained here: Unable to compile QGIS 3.x (master) on Ubuntu 16.04: PyQt5.pyqtconfig module does not exist
Here is the error message I am facing in a popup window during QGIS 3 startup:
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.10' not found (required by /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so)
Python version:
3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]
QGIS version:
3.3.0-Master 'Master', ad4ddb1
Followed by a second popup window:
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.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]
QGIS version:
3.3.0-Master 'Master', ad4ddb1
Then QGIS is ready to use, but there is no Python console (which I really need).
Second try; updating Python3 from 3.5.2
to 3.6.5
:
Then I though it was a Python related issue, so I decided to install Python 3.6.5
(from this PPA: http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu) in parallel to the default system Python 3.5.2
in Ubuntu 16.04.
So I changed the PYTHON_EXECUTABLE, PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to version 3.6 instead of 3.5.
I also made a pip3.6
command in order to install packages for this version of Python and I installed, this time the latest version of the PyQt5 serie:
- PyQt5
version: 5.11.2
- SIP
version: 4.19.12
- QScintilla2
PyQt module: 2.10.7
At QGIS startup, the same two popup windows appeared:
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.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609]
QGIS version:
3.3.0-Master 'Master', ad4ddb1
Followed by:
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.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609]
QGIS version:
3.3.0-Master 'Master', ad4ddb1
What I realized at this point:
is that I was using the Qt5 I installed from the Ubuntu repositories, which version is Qt 5.5.1
.
That's probably why QGIS cannot find the Qt_5.10' string the first try and the
Qt_5.11' string in the second try. It probably wants the system Qt version to be the same than the PyQt module, in the first case PyQt was 5.10.1
and in the second 5.11.2
. So I assume they should be like a family and share the same version numbers (at least up to the minor digit).
I looked after 'how to install Qt 5.10 or Qt 5.11 on Ubuntu 16.04 and foud these PPA:
- http://ppa.launchpad.net/beineri/opt-qt-5.10.1-xenial/ubuntu
- http://ppa.launchpad.net/beineri/opt-qt-5.11.1-xenial/ubuntu
I added them both, installed Qt5.10 and Qt5.11 in /opt
as described on the respective web pages from the PPAs and changed all the Qt5 variable path in cmake to the ones in '/opt/qt51x/lib/cmake/' + the QT_LRELEASE_EXECUTABLE variable to '/opt/qt51x/bin/lrelease' with x in [0 when building QGIS with Python3.5 and x=1 when building with Python3.6].
But then...
New issue:
The configuration and generation is all OK, but the build outputs a lot (!) of C++ errors. I don't want to print them all but it looks like that:
So, to summarize:
Either QGIS compile well with a PyQt 5.11.2 and system Qt 5.5.1 but refuses to load the Python console at startup telling that it cannot find `Qt_5.11' in '/usr/lib/x86_64-linux-gnu/libQt5Core.so
or QGIS doesn't compile when PyQt and Qt version are the same (up to the minor digit).
5.5.1
: gis.stackexchange.com/questions/290448/…