Under Ubuntu 17.04 I develop a Python 3 application using PyQt5 (which uses Qt5 5.8.0) and mysql (5.7.18). All has been well recently until today, I now get upon launching:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
This is what happens if you have not previously done a:
apt-get install libqt5sql5-mysql
but I have done that, and tried uninstalling it and reinstalling it with same result.
Running locate libqsqlmysql
shows me:
/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so
/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins/sqldrivers/libqsqlmysql.so
The first of these is dated Feb 9 2017, I believe it is Qt5 and not PyQt5, it ldd
s without error, and I do not think is relevant.
The second however is dated Jun 21 2017, so looks like the culprit. If I go: ldd /usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins/sqldrivers/libqsqlmysql.so
, in the output I note:
libmysqlclient.so.18 => not found
libssl.so.10 => not found
libcrypto.so.10 => not found
Am I right that is the problem? So it's a PyQt5 issue, not a Qt5 one? Can anyone suggest how to remedy? (I do not have an old state to revert to.)
Well, this turned out to be a
pip3
/PyCharm issue:apt-get install python3-pyqt5
.apt-get install libqt5sql5-mysql
had previously installed/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so
, and all was well.apt-get install python3-pip
(I was lucky I recalled this), and proceeded to do some kind ofpip3 install pyqt5
behind the scenes./usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins/sqldrivers/libqsqlmysql.so
, and as can be seen from theldd
output there had left the area in an incomplete/inconsistent state.pip3 uninstall pyqt5
removed that, and reverted me to an error-free installation.I had previously managed to avoid any
pip3
, successfully installing everything viaapt-get
. This experience has left me not trustingpip3
at all, if it can simply create an erroneous installation without any messages.