I'm trying to learn PyQt5 + qml, and everything I tried so far works fine, however I've ran into a snag when trying to import QtMultimedia into my qml file results in the following error:
plugin cannot be loaded for module "QtMultimedia": Cannot load library D:\py35venvQt\lib\site-packages\PyQt5\Qt\qml\QtMultimedia\declarative_multimedia.dll: The specified module could not be found.
main.qml:
import QtQuick 2.8
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import QtMultimedia 5.6
Window {
id: root
visible: true
title: 'my pyqt app'
width: 1280
height: 720
}
main.py
if __name__ == '__main__':
def handleStatusChange(status):
if status == QQuickView.Error:
errors = appLabel.errors()
if errors:
print (errors[0].description())
myApp = QApplication(sys.argv)
appLabel = QQuickView()
appLabel.statusChanged.connect(handleStatusChange)
model = models.ActorModel(DB_PATH)
ctxt = appLabel.rootContext()
ctxt.setContextProperty('myModel', model)
appLabel.setSource(QUrl('./qml/main/main.qml'))
try:
sys.exit(myApp.exec_())
except:
print("Exiting")
Without the QtMultimedia import everything works fine, also I've tried all Possible version of QtMultimedia (5.0,5.1 etc). In addition the dll does exist in the correct path.
When searching for a solution online I found some post saying that QtMultimedia is not supported in PyQt5, though I think those posts are too old.
I would appreciate it if someone would shed some light on this situation, Thank you.
Edit: Python Version 3.5.2 PyQt Version 5.8.
PyQt installation process: new virtualenv -> pip install pyqt5
Edit2: Tried reinstalling to a completely new virtual environment using pip3 install pyqt5
still getting the same error.
Edit3: According to http://www.dependencywalker.com the following dlls can not be found in the dir where declarative_multimedia.dll is:
QT5MULTIMEDIA.DLL QT5QUICK.DLL QT5GUI.DLL QT5QML.DLL QT5CORE.DLL QT5MULTIMEDIAQUICK_P.DLL
With the exception of QT5MULTIMEDIAQUICK_P.DLL they are all present in the \Lib\site-packages\PyQt5\Qt\bin
directory
QT5MULTIMEDIAQUICK_P.DLL is not present at all.
I tried copying all the missing files into \Lib\site-packages\PyQt5\Qt\qml\QtMultimedia
to see if it would make any difference. It did not.
I also tried to install PyQt 5 into my proper python 3.5 installation (without virtualenv) and running my code. The result is the same.
I had similar issue on Ubuntu and I solved my problem by adding environment variable LD_LIBRARY_PATH=/home/slav/Apps/Qt5.9.2/5.9.2/gcc_64/lib
.
"/home/slav/Apps/Qt5.9.2/5.9.2/gcc_64/lib
" here I've install Qt with QtInstaller
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With