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. Qt5, PyQt5 and opencv: problem with import
Forum Updated to NodeBB v4.3 + New Features

Qt5, PyQt5 and opencv: problem with import

Scheduled Pinned Locked Moved Solved Installation and Deployment
7 Posts 2 Posters 7.2k Views 1 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.
  • J Offline
    J Offline
    Jimmy32
    wrote on 27 Mar 2018, 06:03 last edited by
    #1

    Hi,
    i have installed before Qt5 so i have the .so libraries in the

    usr/lib/x86_64-linux-gnu
    

    and i have also installed PyQt5 in a virtual environment (using)

     pip3 install pyqt5
    

    but when i try to import cv2 and pyQt5 in the same program i got some errors.
    this virtual env contains a link to my opencv library for python 3.5

    without import cv2, i can launch my code
    but if i add import cv2 i got :

    ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.10' not found (required by /home/jimmy/.virtualenvs/keras_tf_qt/lib/python3.5/site-packages/PyQt5/QtCore.so)
    

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Mar 2018, 06:08 last edited by
      #2

      Hi,

      Just an educated guess: you are using an OpenCV version built with your system's Qt while your PyQt5 installation comes with it's own Qt dependencies and they are clashing because you are trying to load two different versions of Qt with the same namespace in the same memory space.

      Either install opencv-python through pip or use your distribution provided PyQt5.

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

      J 1 Reply Last reply 27 Mar 2018, 06:15
      0
      • S SGaist
        27 Mar 2018, 06:08

        Hi,

        Just an educated guess: you are using an OpenCV version built with your system's Qt while your PyQt5 installation comes with it's own Qt dependencies and they are clashing because you are trying to load two different versions of Qt with the same namespace in the same memory space.

        Either install opencv-python through pip or use your distribution provided PyQt5.

        J Offline
        J Offline
        Jimmy32
        wrote on 27 Mar 2018, 06:15 last edited by Jimmy32
        #3

        @SGaist said in Qt5, PyQt5 and opencv: problem with import:
        Thank you for your answer

        use your distribution provided PyQt5.

        Can you detail this please?

        I have installed opencv for python3 like this way
        https://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Mar 2018, 06:27 last edited by
          #4

          What exact linux distribution are you using ?
          How did you install Qt ?

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

          J 1 Reply Last reply 27 Mar 2018, 06:30
          0
          • S SGaist
            27 Mar 2018, 06:27

            What exact linux distribution are you using ?
            How did you install Qt ?

            J Offline
            J Offline
            Jimmy32
            wrote on 27 Mar 2018, 06:30 last edited by
            #5

            @SGaist i am using ubuntu 16.04 LTS and i have installed Qt like this:
            https://www.lucidarme.me/how-install-documentation-for-qt-creator/

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 27 Mar 2018, 21:35 last edited by
              #6

              For your version of Ubuntu the suggested guide is this one.

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

              J 1 Reply Last reply 28 Mar 2018, 02:25
              0
              • S SGaist
                27 Mar 2018, 21:35

                For your version of Ubuntu the suggested guide is this one.

                J Offline
                J Offline
                Jimmy32
                wrote on 28 Mar 2018, 02:25 last edited by
                #7

                @SGaist Thank you for the link
                i have installed opencv this way so i have also linked my opencv to my python3 virtual environment.

                i could finally solved my problem by following this link, i guess it is not the optimal method but it worked...
                http://www.nerdyweekly.com/posts/how-to-install-pyqt5-on-virtualenv-on-ubuntu-14.04/

                1 Reply Last reply
                0

                1/7

                27 Mar 2018, 06:03

                • Login

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