Plugin cannot be loaded for module “QtMultimedia”. Cannot load library declarative_multimedia.dll
-
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") }
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)
Installation of pyqt is from a fresh venv or conda env +
pip install pyqt5
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
-
Same issue here, also using PyQt5 + QML but in macOS, with Python 3.6 and QtMultimedia 5.11. Did you manage to fix it?
I'm running the program in the terminalpython3 mygui.py
in case it matters. -
Hi,
From the looks of it, the deployment of PyQt5 is wrong in that respect. You should check with their author.
You might also want to try PySide2.