Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt5 not finding installed Qt5 library

On Ubuntu 16.0.4, I am trying to run this PyQt5 script, and I have the distributed packages for Qt5 (via apt) and PyQt5 (via pip3) installed.

Error:

sudo ./video_qt.py

Traceback (most recent call last): File "./video_qt.py", line 8, in from PyQt5 import QtWidgets, QtCore ImportError: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not >found (required by /usr/local/lib/python3.5/dist-packages/PyQt5/QtWidgets.so)

But it is there:

ls /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5

/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5

What could be going on here?

like image 203
ryanjdillon Avatar asked Dec 05 '25 07:12

ryanjdillon


2 Answers

I do not have ubuntu to check on.

I would guess that the PyQt in PyPI is not compatible with the installed Qt .so files.

Try pip3 uninstall PyQt and install PyQt from apt should get you binaries that work together.

If its not in apt, ask unbuntu to package it or build PyQt from source. Which not that hard to do.

like image 121
Barry Scott Avatar answered Dec 07 '25 19:12

Barry Scott


I received a similar error message except mine was specifically looking for `Qt_5.12', but it looks like more or less the same problem (version mismatch). I was trying to run my script as:

python3 main.py

I tried uninstalling and reinstalling Qt5 with pip and apt-get, none of that helped. What fixed the problem for me was calling my script with a direct path to python3:

/usr/bin/python3 main.py

Hope this saves someone a headache!

like image 26
Jonathan Avatar answered Dec 07 '25 21:12

Jonathan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!