3

I'm creating a PyQt5 + qml application. Windows 10, PyQt5 5.13.2, Python 3.6. Everything works fine until I try and import QtMultimedia, which results in the error message:

QQmlApplicationEngine failed to load component
file:///C:/Users/user/PycharmProjects/Project/project/pyqt-gui/pyqt-gui/main.qml:9
plugin cannot be loaded for module "QtMultimedia": Cannot load library C:\Users\user\PycharmProjects\Project\venv\lib\site-packages\PyQt5\Qt\qml\QtMultimedia\declarative_multimedia.dll: The specified module could not be found.

This seems to persist across different virtual environments and versions of PyQt and QtMultimedia. I've also confirmed that the .dll file is present in the environment.

main.qml:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.13
import QtQuick.Shapes 1.11
import QtQuick.Dialogs 1.1
import QtQuick.Controls.Styles 1.4
import QtCharts 2.3
import QtMultimedia 5.10

ApplicationWindow {
    id: appWindow
    visible: true
    width: 1920
    height: 1080
    color: "#313131"
    title: qsTr("Project PyQt")
}

main.py:

import sys

from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl

from interface import Interface

if __name__ == '__main__':
    app = QApplication(sys.argv)

    appEngine = QQmlApplicationEngine()

    context = appEngine.rootContext()

    appEngine.load(QUrl('pyqt-gui/main.qml'))

    win = appEngine.rootObjects()[0]

    # Register Python classes with qml
    interface = Interface(app, context, win)

    context.setContextProperty('iface', interface)

    win.show()
    try:
        apcode = app.exec_()
    except:
        print('there was an issue')
    finally:
        sys.exit(apcode)

Any advice on where I'm going wrong much appreciated, I'm very stuck!

Installation of pyqt is from a fresh venv or conda env + pip install pyqt5

Edit 1: On adding os.environ["QT_DEBUG_PLUGINS"] = "1" the console output is:

QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qminimal.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qminimal.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "archreq": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 331008
}


Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qoffscreen.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qoffscreen.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "archreq": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 331008
}


Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qwebgl.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qwebgl.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "webgl"
        ]
    },
    "archreq": 0,
    "className": "QWebGLIntegrationPlugin",
    "debug": false,
    "version": 331008
}


Got keys from plugin meta data ("webgl")
QFactoryLoader::QFactoryLoader() looking at "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qwindows.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qwindows.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "windows"
        ]
    },
    "archreq": 0,
    "className": "QWindowsIntegrationPlugin",
    "debug": false,
    "version": 331008
}


Got keys from plugin meta data ("windows")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/shires/PycharmProjects/DeepLabCut/venv/Scripts/platforms" ...
loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qwindows.dll"
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platformthemes" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platformthemes/qxdgdesktopportal.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platformthemes/qxdgdesktopportal.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "xdgdesktopportal",
            "flatpak",
            "snap"
        ]
    },
    "archreq": 0,
    "className": "QXdgDesktopPortalThemePlugin",
    "debug": false,
    "version": 331008
}


Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/shires/PycharmProjects/DeepLabCut/venv/Scripts/platformthemes" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/styles" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/styles/qwindowsvistastyle.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/styles/qwindowsvistastyle.dll, metadata=
{
    "IID": "org.qt-project.Qt.QStyleFactoryInterface",
    "MetaData": {
        "Keys": [
            "windowsvista"
        ]
    },
    "archreq": 0,
    "className": "QWindowsVistaStylePlugin",
    "debug": false,
    "version": 331008
}


Got keys from plugin meta data ("windowsvista")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/shires/PycharmProjects/DeepLabCut/venv/Scripts/styles" ...
loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/styles/qwindowsvistastyle.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick.2/qtquick2plugin.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QtQuick2Plugin",
    "debug": false,
    "uri": [
        "QtQuick.2"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick.2/qtquick2plugin.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Window.2/windowplugin.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QtQuick2WindowPlugin",
    "debug": false,
    "uri": [
        "QtQuick.Window.2"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Window.2/windowplugin.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Layouts/qquicklayoutsplugin.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QtQuickLayoutsPlugin",
    "debug": false,
    "uri": [
        "QtQuick.Layouts"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Layouts/qquicklayoutsplugin.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Controls.2/qtquickcontrols2plugin.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QtQuickControls2Plugin",
    "debug": false,
    "uri": [
        "QtQuick.Controls.2"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Controls.2/qtquickcontrols2plugin.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Shapes/qmlshapesplugin.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QmlShapesPlugin",
    "debug": false,
    "uri": [
        "QtQuick.Shapes"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Shapes/qmlshapesplugin.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Dialogs/dialogplugin.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QtQuick2DialogsPlugin",
    "debug": false,
    "uri": [
        "QtQuick.Dialogs"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Dialogs/dialogplugin.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtCharts/qtchartsqml2.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QtChartsQml2Plugin",
    "debug": false,
    "uri": [
        "QtCharts"
    ],
    "version": 331008
}


loaded library "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtCharts/qtchartsqml2.dll"
Found metadata in lib C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtMultimedia/declarative_multimedia.dll, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archreq": 0,
    "className": "QMultimediaDeclarativeModule",
    "debug": false,
    "uri": [
        "QtMultimedia"
    ],
    "version": 331008
}


Cannot load library C:\Users\shires\PycharmProjects\DeepLabCut\venv\lib\site-packages\PyQt5\Qt\qml\QtMultimedia\declarative_multimedia.dll: The specified module could not be found.
QLibraryPrivate::loadPlugin failed on "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtMultimedia/declarative_multimedia.dll" : "Cannot load library C:\\Users\\shires\\PycharmProjects\\DeepLabCut\\venv\\lib\\site-packages\\PyQt5\\Qt\\qml\\QtMultimedia\\declarative_multimedia.dll: The specified module could not be found."
QQmlApplicationEngine failed to load component
file:///C:/Users/shires/PycharmProjects/DeepLabCut/deeplabcut/pyqt-gui/pyqt-gui/main.qml:9 plugin cannot be loaded for module "QtMultimedia": Cannot load library C:\Users\shires\PycharmProjects\DeepLabCut\venv\lib\site-packages\PyQt5\Qt\qml\QtMultimedia\declarative_multimedia.dll: The specified module could not be found.

Traceback (most recent call last):
  File "C:/Users/shires/PycharmProjects/DeepLabCut/deeplabcut/pyqt-gui/main.py", line 20, in <module>
    win = appEngine.rootObjects()[0]
IndexError: list index out of range
QLibraryPrivate::unload succeeded on "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/styles/qwindowsvistastyle.dll" 
QLibraryPrivate::unload succeeded on "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/plugins/platforms/qwindows.dll" 
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtCharts/qtchartsqml2.dll" was leaked, with 2 users
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick.2/qtquick2plugin.dll" was leaked, with 2 users
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Controls.2/qtquickcontrols2plugin.dll" was leaked, with 2 users
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Dialogs/dialogplugin.dll" was leaked, with 2 users
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Layouts/qquicklayoutsplugin.dll" was leaked, with 2 users
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Shapes/qmlshapesplugin.dll" was leaked, with 2 users
On QtCore unload, "C:/Users/shires/PycharmProjects/DeepLabCut/venv/lib/site-packages/PyQt5/Qt/qml/QtQuick/Window.2/windowplugin.dll" was leaked, with 2 users

Process finished with exit code 1

Edit 2: Using dependency walker on the 'missing' .dll:

Dependency walker

RoboDoig
  • 51
  • 6
  • You should indicate the characteristics of your environment such as python version, pyqt5, OS, etc. – eyllanesc Dec 02 '19 at 18:10
  • @eyllanesc I've updated my question with my environment characteristics: Windows 10, PyQt5 5.13.2, Python 3.6. I should note that I have the same problem on Mac OS with the same Python and PyQt5 versions. – RoboDoig Dec 02 '19 at 18:15
  • add `os.environ["QT_DEBUG_PLUGINS"] = "1"` before `app = QApplication(sys.argv)`, and tell me what you get in the console – eyllanesc Dec 02 '19 at 18:18
  • @eyllanesc I've added the console output under 'Edit 1' – RoboDoig Dec 02 '19 at 18:25
  • Use dependencywalker: http://www.dependencywalker.com/ and analyze `C:\\Users\\shires\\PycharmProjects\\DeepLabCut\\venv\\lib\\site-packages\\PyQt5\\Qt\\qml\\QtMultimedia\\declarative_multimedia.dll` to see if any other dll is missing – eyllanesc Dec 02 '19 at 18:27
  • @eyllanesc Added under Edit 2 – RoboDoig Dec 02 '19 at 18:37
  • You could show a screenshot of DW. – eyllanesc Dec 02 '19 at 18:40
  • @eyllanesc Added, hopefully that's clearer – RoboDoig Dec 02 '19 at 18:44
  • Dependency Walker does not work well with Windows 10. See here: [https://stackoverflow.com/questions/33604738/dependency-walker-with-kernel32-dll-on-windows-10](https://stackoverflow.com/questions/33604738/dependency-walker-with-kernel32-dll-on-windows-10) – drescherjm Dec 03 '19 at 02:55
  • @drescherjm I get a very similar result with the alternative suggested in that thread (Dependencies by lucasg). Both programs show missing Qt dlls for declarative_multimedia.dll, but they also show this for plugins that are working fine in my environment like QtCharts. – RoboDoig Dec 03 '19 at 18:56
  • I have the same issue. Did you find a solution or installing Linux might be the best solution? – Amrith Oct 10 '21 at 20:11

0 Answers0