Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QMYSQL driver failing to load
Forum Updated to NodeBB v4.3 + New Features

QMYSQL driver failing to load

Scheduled Pinned Locked Moved Solved Qt for Python
9 Posts 3 Posters 1.4k 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.
  • E Offline
    E Offline
    Emia
    wrote on last edited by
    #1

    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 plugin

    It 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 EhrlicherC 1 Reply Last reply
    0
    • SGaistS SGaist

      @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 Offline
      E Offline
      Emia
      wrote on last edited by
      #9

      @SGaist
      When I put the correct (vers. 6.4.3) driver file in the folder given to me by the core.libraryPaths() command, which is at the end of the script in the first post, everything works fine. So this post can be marked solved.

      1 Reply Last reply
      0
      • E Emia

        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 plugin

        It 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 EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @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.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        E 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @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.

          E Offline
          E Offline
          Emia
          wrote on last edited by
          #3

          @Christian-Ehrlicher

          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

          Christian EhrlicherC 1 Reply Last reply
          0
          • E Emia

            @Christian-Ehrlicher

            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

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Emia said in QMYSQL driver failing to load:

            PyQt6.)

            You installed PyQt6 so you should know the exact version number of the installed package.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • E Offline
              E Offline
              Emia
              wrote on last edited by
              #5

              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.

              Christian EhrlicherC 1 Reply Last reply
              0
              • E Emia

                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.

                Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @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?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                SGaistS E 2 Replies Last reply
                0
                • SGaistS SGaist moved this topic from General and Desktop on
                • Christian EhrlicherC Christian Ehrlicher

                  @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?

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @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.

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

                  E 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    @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?

                    E Offline
                    E Offline
                    Emia
                    wrote on last edited by
                    #8

                    @Christian-Ehrlicher
                    Why didn't you just tell me that?
                    Did you read the very first line of my very first post???

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      @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 Offline
                      E Offline
                      Emia
                      wrote on last edited by
                      #9

                      @SGaist
                      When I put the correct (vers. 6.4.3) driver file in the folder given to me by the core.libraryPaths() command, which is at the end of the script in the first post, everything works fine. So this post can be marked solved.

                      1 Reply Last reply
                      0
                      • E Emia has marked this topic as solved on

                      • Login

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