Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Import error in python qgis.core
Forum Updated to NodeBB v4.3 + New Features

Import error in python qgis.core

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
6 Posts 3 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amidomaru
    wrote on 17 Nov 2019, 14:39 last edited by
    #1

    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.

    P 1 Reply Last reply 17 Nov 2019, 21:07
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Nov 2019, 19:13 last edited by
      #2

      Hi and welcome to devnet,

      What version of Qt do you have installed ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply 18 Nov 2019, 12:44
      0
      • A Amidomaru
        17 Nov 2019, 14:39

        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.

        P Offline
        P Offline
        Pablo J. Rogina
        wrote on 17 Nov 2019, 21:07 last edited by
        #3

        @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

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        A 1 Reply Last reply 18 Nov 2019, 12:34
        1
        • P Pablo J. Rogina
          17 Nov 2019, 21:07

          @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

          A Offline
          A Offline
          Amidomaru
          wrote on 18 Nov 2019, 12:34 last edited by
          #4

          @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.

          1 Reply Last reply
          0
          • S SGaist
            17 Nov 2019, 19:13

            Hi and welcome to devnet,

            What version of Qt do you have installed ?

            A Offline
            A Offline
            Amidomaru
            wrote on 18 Nov 2019, 12:44 last edited by
            #5

            @SGaist

            :/$ qmake --version
            QMake version 3.1
            Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
            
            
            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 18 Nov 2019, 17:03 last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              3/6

              17 Nov 2019, 21:07

              • Login

              • Login or register to search.
              3 out of 6
              • First post
                3/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved