Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Import error in python qgis.core



  • I have installed qgis 3.10 Coruna in ubuntu 18.04 with sudo apt-get install. And I want to write a stand-alone script. I follow guide and type from qgis.core import * and get the following message:

    ImportError: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: symbol _ZNK15QDateTimeParser5parseER7QStringRiRK9QDateTimeb version Qt_5_PRIVATE_API not defined in file libQt5Core.so.5 with link time reference
    

    I haven't installed Qt manually, It was loaded as qgis dependency. So I don't know about compiler options or anything like that.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt do you have installed ?



  • @Amidomaru I happened to have Lubuntu 18.04 but strangely the latest available release for python-qgis seems to be 2.18.x, see output from command sudo sudo apt install --dry-run python-qgis (--dry-run is the option to simulate running the command without actually performing it):

    ...
    Inst python-qgis (2.18.17+dfsg-1 Ubuntu:18.04/bionic [amd64])
    ...
    

    not sure how you installed python-qgis 3.10 though

    In addition, from the related dependencies I can see it will install PyQt 4 and the corresponding Qt 4 libraries.

    ...
    Inst libqtcore4 (4:4.8.7+dfsg-7ubuntu1 Ubuntu:18.04/bionic [amd64])
    ...
    

    so the error with the Qt5 library seems to show that you already had Qt 5 framework installed beforehand, and somehow it has precedence in the path(s) to the Qt 4.x libraries installed as dependencies for qgis



  • @Pablo-J-Rogina I followed instructions from https://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu and may be some other from google. QGIS itself works normally and I can run scripts in Python Console.
    And output from your command:

    :~$sudo apt install --dry-run python-qgis
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    python-qgis is already the newest version (1:3.10.0+28bionic).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    

    And other that I tried:

    :~$ sudo apt install libqtcore4
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    libqtcore4 is already the newest version (4:4.8.7+dfsg-7ubuntu1).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    

    If I get this right:
    Qt5 and Qt4 are both dependency's for QGIS 3.10
    And only Qt4 for QGIS 2.18?

    Most likely I didn't have any Qt before this QGIS installation.



  • @SGaist

    :/$ qmake --version
    QMake version 3.1
    Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
    
    

  • Lifetime Qt Champion

    Then it's possible that it is using private APIs and is built against a different version of Qt that may be more recent than the one you have.


Log in to reply