QMYSQL driver failing to load
-
I'm working on a python311/PyQt6 installation on Windows 11.
I don't know anything about making or building drivers, so I downloaded an already built qsqlmysql.dll file from thecodemonkey86 (https://github.com/thecodemonkey86/qt_mysql_driver/releases/tag/qmysql_6.5.0) and put it in the sqldrivers folder. I set the QT_DEBUG_PLUGINS variable to 1 and ran the following code using the python instance in the venv:from PyQt6.QtCore import QCoreApplication
core = QCoreApplication
from PyQt6.QtSql import QSqlDatabase
db=QSqlDatabase.addDatabase("QMYSQL")
print(f"\n {db.drivers()}")
print(f"\n {core.libraryPaths()}")The factoryloader found all the drivers, including QMSQL, but threw an error saying:
qsqlmysql.dll' uses incompatible Qt library. (6.5.0) [release]Here's that section of the debug output:
qt.core.plugin.factoryloader: looking at "C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll"
qt.core.plugin.loader: Found metadata in lib C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMYSQL",
"QMARIADB"
]
},
"archlevel": 0,
"className": "QMYSQLDriverPlugin",
"debug": false,
"version": 394496
}qt.core.plugin.loader: In C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll:
Plugin uses incompatible Qt library (6.5.0) [release]
qt.core.plugin.factoryloader: "The plugin 'C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (6.5.0) [release]"
not a pluginIt then finished up with:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QPSQL
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
['QSQLITE', 'QODBC', 'QPSQL']
['C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins']The github download included:
libmysql.dll (vers. 8.0.32.0),
libcrypto-1_1-x64.dll (vers. 1.1.1.20)
and libssl-1_1-x64.dll (vers. 1.1.1.20).The existing libmysql.dll in the bin folder was vers. 8.0.33.0, but replacing it with the older version made no difference.
I'm just trying to teach myself python and make a GUI and I'm in way over my head here. Can you help?
-
@Christian-Ehrlicher we do have a Qt for Python dedicated section though (to which this thread has been moved).
@Emia, there's nothing wrong with not knowing how to do something, we were all beginners at some point. Let us know when you don't, as it will allow us to adapt the answer we can provide.
One typical question I have to ask with PyQt/PySide related threads is the method of installation as there are many different ways: pip, conda, pip in conda, poetry, system packages, etc. So helping you getting the answer to the question we asked will depend on that.
-
I'm working on a python311/PyQt6 installation on Windows 11.
I don't know anything about making or building drivers, so I downloaded an already built qsqlmysql.dll file from thecodemonkey86 (https://github.com/thecodemonkey86/qt_mysql_driver/releases/tag/qmysql_6.5.0) and put it in the sqldrivers folder. I set the QT_DEBUG_PLUGINS variable to 1 and ran the following code using the python instance in the venv:from PyQt6.QtCore import QCoreApplication
core = QCoreApplication
from PyQt6.QtSql import QSqlDatabase
db=QSqlDatabase.addDatabase("QMYSQL")
print(f"\n {db.drivers()}")
print(f"\n {core.libraryPaths()}")The factoryloader found all the drivers, including QMSQL, but threw an error saying:
qsqlmysql.dll' uses incompatible Qt library. (6.5.0) [release]Here's that section of the debug output:
qt.core.plugin.factoryloader: looking at "C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll"
qt.core.plugin.loader: Found metadata in lib C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMYSQL",
"QMARIADB"
]
},
"archlevel": 0,
"className": "QMYSQLDriverPlugin",
"debug": false,
"version": 394496
}qt.core.plugin.loader: In C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll:
Plugin uses incompatible Qt library (6.5.0) [release]
qt.core.plugin.factoryloader: "The plugin 'C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (6.5.0) [release]"
not a pluginIt then finished up with:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QPSQL
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
['QSQLITE', 'QODBC', 'QPSQL']
['C:/BCET/BCET-UI-Project/BCET-venv/Lib/site-packages/PyQt6/Qt6/plugins']The github download included:
libmysql.dll (vers. 8.0.32.0),
libcrypto-1_1-x64.dll (vers. 1.1.1.20)
and libssl-1_1-x64.dll (vers. 1.1.1.20).The existing libmysql.dll in the bin folder was vers. 8.0.33.0, but replacing it with the older version made no difference.
I'm just trying to teach myself python and make a GUI and I'm in way over my head here. Can you help?
@Emia said in QMYSQL driver failing to load:
uses incompatible Qt library. (6.5.0)
This tells you the exact error - you're Qt version and the plugin version does not match.
-
@Emia said in QMYSQL driver failing to load:
uses incompatible Qt library. (6.5.0)
This tells you the exact error - you're Qt version and the plugin version does not match.
Yeah, but
(1) how do I find the Qt library version number that I need to match? Judging by the file names, I have Qt6 installed. (I don't know sub-version numbers, it was all loaded when I installed PyQt6.)(2) github is actually showing two 6.5.0 drivers on their site:
qsqlmysql.dll_Qt_SQL_driver_6.5.0_MinGW_11.2.0_64-bit.zip
qsqlmysql.dll_Qt_SQL_driver_6.5.0_MSVC2019_64-bit.zip
Does it matter which I use? I grabbed the MSCV one.I didn't expect such a quick reply.
Thanks -
Yeah, but
(1) how do I find the Qt library version number that I need to match? Judging by the file names, I have Qt6 installed. (I don't know sub-version numbers, it was all loaded when I installed PyQt6.)(2) github is actually showing two 6.5.0 drivers on their site:
qsqlmysql.dll_Qt_SQL_driver_6.5.0_MinGW_11.2.0_64-bit.zip
qsqlmysql.dll_Qt_SQL_driver_6.5.0_MSVC2019_64-bit.zip
Does it matter which I use? I grabbed the MSCV one.I didn't expect such a quick reply.
Thanks@Emia said in QMYSQL driver failing to load:
PyQt6.)
You installed PyQt6 so you should know the exact version number of the installed package.
-
Well, in the interest of sharing, I'll tell you that I've now learned that all the installed version numbers can be obtained by simply entering the command "pip list" at the command prompt when in the environment of interest.
I should also say that I'm disappointed that I wasn't able to get any help from this forum.
-
Well, in the interest of sharing, I'll tell you that I've now learned that all the installed version numbers can be obtained by simply entering the command "pip list" at the command prompt when in the environment of interest.
I should also say that I'm disappointed that I wasn't able to get any help from this forum.
@Emia said in QMYSQL driver failing to load:
I should also say that I'm disappointed that I wasn't able to get any help from this forum.
You know you're in a c++ forum here?
-
S SGaist moved this topic from General and Desktop on
-
@Emia said in QMYSQL driver failing to load:
I should also say that I'm disappointed that I wasn't able to get any help from this forum.
You know you're in a c++ forum here?
@Christian-Ehrlicher we do have a Qt for Python dedicated section though (to which this thread has been moved).
@Emia, there's nothing wrong with not knowing how to do something, we were all beginners at some point. Let us know when you don't, as it will allow us to adapt the answer we can provide.
One typical question I have to ask with PyQt/PySide related threads is the method of installation as there are many different ways: pip, conda, pip in conda, poetry, system packages, etc. So helping you getting the answer to the question we asked will depend on that.
-
@Emia said in QMYSQL driver failing to load:
I should also say that I'm disappointed that I wasn't able to get any help from this forum.
You know you're in a c++ forum here?
@Christian-Ehrlicher
Why didn't you just tell me that?
Did you read the very first line of my very first post??? -
@Christian-Ehrlicher we do have a Qt for Python dedicated section though (to which this thread has been moved).
@Emia, there's nothing wrong with not knowing how to do something, we were all beginners at some point. Let us know when you don't, as it will allow us to adapt the answer we can provide.
One typical question I have to ask with PyQt/PySide related threads is the method of installation as there are many different ways: pip, conda, pip in conda, poetry, system packages, etc. So helping you getting the answer to the question we asked will depend on that.
-
E Emia has marked this topic as solved on