[QGIS-Developer] Building QGIS with QT6 on Ubuntu: Python error at start
Alessandro Pasotti
apasotti at gmail.com
Tue Jul 22 00:00:33 PDT 2025
Thank you Richard,
your workflow is almost exactly the same I am doing.
With the help of Nyall I have been able to track down the issue to a
missing package python3-pyqt6.qtmultimedia.
The debugging process involved removing all the imports from
https://github.com/qgis/QGIS/blob/master/python/PyQt6/gui/gui.sip.in
and find the broken piece, to my surprise, removing the lines highlighted
here
https://github.com/qgis/QGIS/blob/master/python/PyQt6/gui/gui.sip.in#L16C1-L20C22
eventually led to a readable error message (QtMultimedia could not be
imported) instead of the corrupted one.
Why the error message gets corrupted after qsci is imported (or after
https://github.com/qgis/QGIS/blob/master/python/PyQt6/gui/gui_auto.sip is
imports, I don't know which one is responsible of the issue) still remains
a mystery to me.
Thank you all for the help!
On Mon, Jul 21, 2025 at 8:23 PM Richard Duivenvoorde <rdmailings at duif.net>
wrote:
> I'm on Trixie (next stable in a couple of weeks), and only build QWT
> myself from source:
>
> # https://qwt.sourceforge.io/qwtinstall.html
> # download the tar.bz2 from
> https://sourceforge.net/projects/qwt/files/qwt/6.3.0/
> # unpack and go into ~/git/qwt-6.3.0 dir
> # error: qmake: could not find a Qt installation of '' ->
> https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of
> ?
> qtchooser -install qt6 $(which qmake6)
> export QT_SELECT=qt6
> # create Makefile
> /usr/bin/qmake qwt.pro
> # compile
> make
> # install (in /usr/local/qwt-6.3.0 )
> sudo make install
>
> Then, leaving out a lot of stuff...:
>
> mkdir buildqt6;cd buildqt6;ccmake -GNinja -DBUILD_TESTING=FALSE
> -DENABLE_TESTS=OFF -DWITH_SERVER=FALSE -DWITH_3D=FALSE
> -DCMAKE_INSTALL_PREFIX=/home/richard/bin/qgis_/qt6/debug
> -DWITH_QWTPOLAR=OFF -DCMAKE_BUILD_TYPE=Debug -DWITH_GRASS=FALSE
> -DBUILD_WITH_QT6=TRUE -DWITH_OAUTH2_PLUGIN=FALSE
> -DWITH_WITH_SERVER_PLUGINS=OFF -DWITH_STAGED_PLUGINS=OFF -DWITH_PDAL=OFF
> -DWITH_QTWEBKIT=OFF -DQWT_INCLUDE_DIR=/usr/local/qwt-6.3.0/include
> -DQWT_LIBRARY=/usr/local/qwt-6.3.0/lib/libqwt.so ..
>
> in the same git repo as my qt5 build, QGIS works.
>
> I'm on python 3.13.5 here
>
> Not sure if this helps...
>
> Richard
>
>
>
>
> On 21-07-2025 17:52, Alessandro Pasotti via QGIS-Developer wrote:
> >
> > Thanks, I'm using Python 3.13 (that comes with that Ubuntu version).
> >
> > Now I'm trying with vcpkg ...
> >
> >
> > On Mon, Jul 21, 2025 at 5:35 PM pathmapper <pathmapper at posteo.de
> <mailto:pathmapper at posteo.de>> wrote:
> >
> > Hi,
> >
> > I don't know what's wrong, but when I had similar problems,
> switching to
> > Python 3.12 solved them for me.
> >
> > Cheers,
> > Björn
> >
> > On 21.07.2025 16:58, Alessandro Pasotti via QGIS-Developer wrote:
> > > Hi,
> > >
> > > I am trying to build QGIS with QT6 on Ubuntu (tried 24.10 and
> 25.04),
> > > it builds without errors but when I run it, the following error
> > > appears:
> > >
> > > Couldn't load PyQGIS.
> > > Python support will be disabled.
> > >
> > > Traceback (most recent call last):
> > > File "", line 1, in
> > > File
> > >
> "/home/ale/dev/QGIS/build/Desktop_QT6-Debug/output/python/qgis/gui/__init__.py",
> > > line 25, in
> > > from qgis._gui import *
> > > RuntimeError: qgis._gui cannot import type '���A� ' from
> > > PyQt6.QtCore
> > >
> > > Python version:
> > > 3.13.3 (main, Jun 16 2025, 18:15:32) [GCC 14.2.0]
> > >
> > > QGIS version:
> > > 3.99.0-Master 'Master', e717e3cd2b9
> > >
> > > Python path:
> > > ['/home/ale/dev/QGIS/build/Desktop_QT6-Debug/output/python',
> > > '/home/ale/.local/share/QGIS/QGIS3/profiles/default/python',
> > >
> '/home/ale/.local/share/QGIS/QGIS3/profiles/default/python/plugins',
> > >
> '/home/ale/dev/QGIS/build/Desktop_QT6-Debug/output/python/plugins',
> > >
> '/home/ale/dev/gdal/desktop-install/local/lib/python3.13/dist-packages',
> > > '/home/ale/dev/gdal/autotest/pymod', '/usr/lib/python313.zip',
> > > '/usr/lib/python3.13', '/usr/lib/python3.13/lib-dynload',
> > > '/usr/local/lib/python3.13/dist-packages',
> > > '/usr/lib/python3/dist-packages']
> > >
> > > I checked the QGIS/build/Desktop_QT6-Debug/output/python/qgis
> content
> > > and it looks legit.
> > >
> > > PyQt6 installation also looks ok, importing core works ok, only
> gui
> > > does not work.
> > >
> > > Any idea about what's going wrong?
> > >
> > > --
> > >
> > > Alessandro Pasotti
> > > QCooperative: www.qcooperative.net <http://www.qcooperative.net>
> [1]
> > > ItOpen: www.itopen.it <http://www.itopen.it> [2]
> > >
> > > Links:
> > > ------
> > > [1] https://www.qcooperative.net <https://www.qcooperative.net>
> > > [2] http://www.itopen.it <http://www.itopen.it>
> > >
> > > _______________________________________________
> > > QGIS-Developer mailing list
> > > QGIS-Developer at lists.osgeo.org <mailto:
> QGIS-Developer at lists.osgeo.org>
> > > List info:
> https://lists.osgeo.org/mailman/listinfo/qgis-developer <
> https://lists.osgeo.org/mailman/listinfo/qgis-developer>
> > > Unsubscribe:
> https://lists.osgeo.org/mailman/listinfo/qgis-developer <
> https://lists.osgeo.org/mailman/listinfo/qgis-developer>
> >
> >
> >
> > --
> > Alessandro Pasotti
> > QCooperative: www.qcooperative.net <https://www.qcooperative.net>
> > ItOpen: www.itopen.it <http://www.itopen.it>
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
--
Alessandro Pasotti
QCooperative: www.qcooperative.net
ItOpen: www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20250722/84149c22/attachment.htm>
More information about the QGIS-Developer
mailing list