Qt5, PyQt5 and opencv: problem with import
-
Hi,
i have installed before Qt5 so i have the .so libraries in theusr/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.5without 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
-
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. -
@SGaist said in Qt5, PyQt5 and opencv: problem with import:
Thank you for your answeruse 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/ -
What exact linux distribution are you using ?
How did you install Qt ? -
For your version of Ubuntu the suggested guide is this one.
-
@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/