5

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.

Curtwagner1984
  • 1,908
  • 4
  • 30
  • 48
  • I have used multimedia with qml in pyqt5 and I have had no problems. – eyllanesc Mar 09 '17 at 21:01
  • @eyllanesc On windows? If so that is good news and something is wrong with my setup. Though I don't know what... – Curtwagner1984 Mar 09 '17 at 21:49
  • my OS is linux, To improve your post you could show the installation process you used for pyqt – eyllanesc Mar 09 '17 at 21:58
  • @eyllanesc I created a fresh virtualenv and used `pip install pyqt5` that's all. – Curtwagner1984 Mar 09 '17 at 23:38
  • This seems to be a real pain. Running a script with this from editor works fine but not from command-line. pyqt5.6.0, qt5.6.2 with Conda 4.4.11 on windows 10x64 SP1 shows same issues. Environment-path is set C:\Python\Anac2\Lib\site-packages and C:\Python\Qt590. – ZF007 Mar 11 '18 at 10:58
  • I'm having exactly the same issue both in Windows and in macOS. Any updates? – alrevuelta Feb 17 '20 at 09:06
  • @alrevuelta Yeah. I've tried it again on a clean machine a few months ago and it seemed to work just fine. Maybe some of my old packages or installed software somehow interfered with it. Or maybe they fixed it. I don't know. All I know is that I tried on a fresh installed windows machine and it just worked. – Curtwagner1984 Mar 24 '20 at 15:34

2 Answers2

1

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

slavugan
  • 1,463
  • 17
  • 17
-1

maybe You should use pyqt not pyside

Emad Deve
  • 33
  • 10