In a new shiny ubuntu 18.04, I am trying to use a python3/pyqt5 script that use QtMultimedia.

It was working fine in 17.10. And now even after installing a bunch of package, I still can't get it to work. I have the following error when a QMediaplayer is instanciated:

defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"

I assume it is an error because Qt5 and QtMultimedia can't find a proper backend registered right ?

I have all these package installed:

gir1.2-gstreamer-1.0 1.14.0-1
gstreamer1.0-alsa:amd64 1.14.0-2ubuntu1
gstreamer1.0-clutter-3.0:amd64 3.0.26-1
gstreamer1.0-fluendo-mp3:amd64 0.10.32.debian-1
gstreamer1.0-gl:amd64 1.14.0-2ubuntu1
gstreamer1.0-libav:amd64 1.14.0-1
gstreamer1.0-packagekit 1.1.9-1ubuntu2
gstreamer1.0-plugins-bad:amd64 1.14.0-1ubuntu1
gstreamer1.0-plugins-base:amd64 1.14.0-2ubuntu1
gstreamer1.0-plugins-base-apps 1.14.0-2ubuntu1
gstreamer1.0-plugins-good:amd64 1.14.0-1ubuntu1
gstreamer1.0-plugins-ugly:amd64 1.14.0-1
gstreamer1.0-pulseaudio:amd64 1.14.0-1ubuntu1
gstreamer1.0-python3-plugin-loader 1.14.0-1
gstreamer1.0-qt5:amd64 1.14.0-1ubuntu1
gstreamer1.0-tools 1.14.0-1
gstreamer1.0-vaapi:amd64 1.14.0-1
gstreamer1.0-x:amd64 1.14.0-2ubuntu1
libgstreamer1.0-0:amd64 1.14.0-1
libgstreamer-gl1.0-0:amd64 1.14.0-2ubuntu1
libgstreamer-plugins-bad1.0-0:amd64 1.14.0-1ubuntu1
libgstreamer-plugins-base1.0-0:amd64 1.14.0-2ubuntu1
libgstreamer-plugins-good1.0-0:amd64 1.14.0-1ubuntu1
libqt5core5a:amd64 5.9.5+dfsg-0ubuntu1
libqt5dbus5:amd64 5.9.5+dfsg-0ubuntu1
libqt5designer5:amd64 5.9.5-0ubuntu1
libqt5glib-2.0-0:amd64 1.2.0-5
libqt5gstreamer-1.0-0:amd64 1.2.0-5
libqt5gui5:amd64 5.9.5+dfsg-0ubuntu1
libqt5help5:amd64 5.9.5-0ubuntu1
libqt5multimedia5:amd64 5.9.5-0ubuntu1
libqt5multimediawidgets5:amd64 5.9.5-0ubuntu1
libqt5network5:amd64 5.9.5+dfsg-0ubuntu1
libqt5opengl5:amd64 5.9.5+dfsg-0ubuntu1
libqt5printsupport5:amd64 5.9.5+dfsg-0ubuntu1
libqt5qml5:amd64 5.9.5-0ubuntu1
libqt5quick5:amd64 5.9.5-0ubuntu1
libqt5sql5:amd64 5.9.5+dfsg-0ubuntu1
libqt5sql5-sqlite:amd64 5.9.5+dfsg-0ubuntu1
libqt5svg5:amd64 5.9.5-0ubuntu1
libqt5test5:amd64 5.9.5+dfsg-0ubuntu1
libqt5widgets5:amd64 5.9.5+dfsg-0ubuntu1
libqt5x11extras5:amd64 5.9.5-0ubuntu1
libqt5xml5:amd64 5.9.5+dfsg-0ubuntu1
libreoffice-avmedia-backend-gstreamer 1:6.0.3-0ubuntu1
python3-pyqt5 5.10.1+dfsg-1ubuntu2
python3-pyqt5.qtmultimedia 5.10.1+dfsg-1ubuntu2
qt5-gtk-platformtheme:amd64 5.9.5+dfsg-0ubuntu1
qtgstreamer-plugins-qt5:amd64 1.2.0-5

When I compare this list with the one I got on 17.10, I don't seem to miss any. So ?

I run the script with QT_DEBUG_PLUGINS=1 set, and I didn't see any error or problem.


Just solved my issue so maybe it will help you too.

Copy-past below:

The problem was that I had few two versions of PyQt5 and sip installed for Python3. One was in /usr/lib/python3/dist-packages/ and the other in ~/.local/lib/python3.6/site-pacages/. Completely deleting .local versions helped.

|improve this answer|||||
  • I have no version of PyQt5 nor sip in ./local/... so this does not help me – solsTiCe Jul 21 '18 at 15:36

For anyone stumbling across this, here is the proper setup which will build Qt 5.11.2 as non-root, then install pyqt 5.11.2 with GStreamer 1.0 support on Ubuntu 18.04 into a virtual environment using python >= 3.6:

  1. Install gstreamer1.0
  2. Install pulse (This is required so QMultimediaWidgets is build) sudo apt install libpulse-dev
  3. Download Qt 5.11.2
  4. Make the downloaded file executable and run it (chmod +x qt-unified-linux-x64-3.0.5-online.run). Click through the wizard. I'm assuming you are installing to $HOME/Qt
  5. Create a virtual environment python -m venv venv.
  6. Download SIP 4.19.12 and unpack
  7. Download pyqt 5.11.2 and unpack
  8. Activate your environment source venv/bin/activate
  9. Install SIP:
    • Go inside the SIP folder
    • Tell it to use your virtual env python configure.py -d ../venv/lib/python3.6/site-packages
    • make -j4
    • make install
    • Build a private copy for Qt: python configure.py -d ../venv/lib/python3.6/site-packages --sip-module PyQt5.sip --no-tools
    • make -j4
    • make install
  10. Install PyQt:
    • Go inside the PyQt folder
    • Tell it which qmake, python and sip to use python configure.py --destdir ../venv/lib/python3.6/site-packages --qmake ~/Qt/5.11.2/gcc_64/bin/qmake --sip ../venv/bin/sip
    • make -j12
    • make install

That should be it now. Based on http://pyqt.sourceforge.net/Docs/PyQt5/installation.html, http://pyqt.sourceforge.net/Docs/sip4/installation.html and a lot of trial and error. If something does not work, I recommend using --verbose during the configuration step of PyQt.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.