Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Could not load the Qt platform plugin "xcb"
QtWS25 Last Chance

Could not load the Qt platform plugin "xcb"

Scheduled Pinned Locked Moved Solved Installation and Deployment
8 Posts 3 Posters 16.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arsaa
    wrote on last edited by arsaa
    #1

    Sorry for repeated question, but I still can't resolve my problem.
    I have anaconda3, Qt Creator and Qt Designer installed on Ubuntu 18.04. Everything worked fine until I tried to run (in anaconda spyder) a simple application which used QT Quick and QML.

    Code
    """
    import sys
    from PySide2.QtWidgets import QApplication
    from PySide2.QtQuick import QQuickView
    from PySide2.QtCore import QUrl

    app = QApplication([])
    view = QQuickView()
    url = QUrl("/path/to/file/pyside2/pyside_first.qml")

    view.setSource(url)
    view.show()
    app.exec_()

    """

    ipython console

    """
    ImportError: /home/user/anaconda3/lib/python3.7/site-packages/PyQt5/../../../libQt5Core.so.5: version `Qt_5.14' not found (required by /home/user/anaconda3/lib/python3.7/site-packages/PySide2/libpyside2.abi3.so.5.14)

    """

    I tried to execute code in system console.

    """
    (base) UL30A:~$ python
    Python 3.7.3 (default, Mar 27 2019, 22:11:17)
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.

    import sys
    from PySide2.QtWidgets import QApplication
    from PySide2.QtQuick import QQuickView
    from PySide2.QtCore import QUrl
    app = QApplication([])
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, xcb.
    """

    Other applications with using PyQT5 or PySide2 without QML worked as expected

    I tried to resolve this problem by editing qt.conf file and adding a right path to my qt platform version. I found

    ./anaconda3/lib/python3.7/site-packages/PySide2/Qt/libexec/qt.conf
    ./anaconda3/pkgs/qt-5.9.7-h5867ecd_1/bin/qt.conf
    ./anaconda3/pkgs/qt-5.9.7-h5867ecd_1/info/recipe/qt.conf
    ./anaconda3/bin/qt.conf

    I do not know which of them I need to edit, which path I need to add and where I need to add it.

    As concern to plugin "xcb" I found in my system

    ./anaconda3/lib/python3.7/site-packages/PySide2/Qt/plugins/platforms/libqxcb.so
    ./anaconda3/pkgs/qt-5.9.7-h5867ecd_1/plugins/platforms/libqxcb.so
    ./anaconda3/plugins/platforms/libqxcb.so

    Again, what I need to do with this libraries? Copy them? Where?
    Please, help to resolve this task.

    JonBJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #6

      I would start by just creating an empty new conda environment and then install PySide2 in it so you can test it again.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A arsaa

        Sorry for repeated question, but I still can't resolve my problem.
        I have anaconda3, Qt Creator and Qt Designer installed on Ubuntu 18.04. Everything worked fine until I tried to run (in anaconda spyder) a simple application which used QT Quick and QML.

        Code
        """
        import sys
        from PySide2.QtWidgets import QApplication
        from PySide2.QtQuick import QQuickView
        from PySide2.QtCore import QUrl

        app = QApplication([])
        view = QQuickView()
        url = QUrl("/path/to/file/pyside2/pyside_first.qml")

        view.setSource(url)
        view.show()
        app.exec_()

        """

        ipython console

        """
        ImportError: /home/user/anaconda3/lib/python3.7/site-packages/PyQt5/../../../libQt5Core.so.5: version `Qt_5.14' not found (required by /home/user/anaconda3/lib/python3.7/site-packages/PySide2/libpyside2.abi3.so.5.14)

        """

        I tried to execute code in system console.

        """
        (base) UL30A:~$ python
        Python 3.7.3 (default, Mar 27 2019, 22:11:17)
        [GCC 7.3.0] :: Anaconda, Inc. on linux
        Type "help", "copyright", "credits" or "license" for more information.

        import sys
        from PySide2.QtWidgets import QApplication
        from PySide2.QtQuick import QQuickView
        from PySide2.QtCore import QUrl
        app = QApplication([])
        qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
        This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

        Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, xcb.
        """

        Other applications with using PyQT5 or PySide2 without QML worked as expected

        I tried to resolve this problem by editing qt.conf file and adding a right path to my qt platform version. I found

        ./anaconda3/lib/python3.7/site-packages/PySide2/Qt/libexec/qt.conf
        ./anaconda3/pkgs/qt-5.9.7-h5867ecd_1/bin/qt.conf
        ./anaconda3/pkgs/qt-5.9.7-h5867ecd_1/info/recipe/qt.conf
        ./anaconda3/bin/qt.conf

        I do not know which of them I need to edit, which path I need to add and where I need to add it.

        As concern to plugin "xcb" I found in my system

        ./anaconda3/lib/python3.7/site-packages/PySide2/Qt/plugins/platforms/libqxcb.so
        ./anaconda3/pkgs/qt-5.9.7-h5867ecd_1/plugins/platforms/libqxcb.so
        ./anaconda3/plugins/platforms/libqxcb.so

        Again, what I need to do with this libraries? Copy them? Where?
        Please, help to resolve this task.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @arsaa
        There are a lot of hits if you Google for: Could not load the Qt platform plugin "xcb".

        Start from e.g. https://forum.qt.io/topic/93247/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found, or others if they are more akin to your situation.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          arsaa
          wrote on last edited by arsaa
          #3

          JonB thank you for your reply. Before I wrote my post I have tried the solution described in the post you mentioned
          @arsaa-UL30A:~$ sudo pacman -S libxcb
          $: command not found

          I tried ubuntu package manager
          arsaa@arsaa-UL30A:~$ sudo apt install libxcb
          [sudo] password for arsaa:
          resolving dependencies...
          No packages found

          What wrong with my installation of Qt libraries?

          I tried to run my code with QT_DEBUG_PLUGINS =1. I got information with QT_DEBUG_PLUGINS =1 and I am trying to guess what to do with it. :-)

          .....
          Got keys from plugin meta data ("xcb")
          QFactoryLoader::QFactoryLoader() checking directory path "/home/arsaa/anaconda3/bin/platforms" ...
          Cannot load library /home/arsaa/anaconda3/plugins/platforms/libqxcb.so: (/home/arsaa/anaconda3/plugins/platforms/../../lib/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)
          QLibraryPrivate::loadPlugin failed on "/home/arsaa/anaconda3/plugins/platforms/libqxcb.so" : "Cannot load library /home/arsaa/anaconda3/plugins/platforms/libqxcb.so: (/home/arsaa/anaconda3/plugins/platforms/../../lib/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)"
          qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
          This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

          Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, xcb

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Hi and welcome to devnet,

            Are all your packages coming from the same conda channel ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              arsaa
              wrote on last edited by
              #5

              Hi, SGaist. No, there was period of my learning Linux and Python and I installed packages from different sources. Do I need to reinstall anaconda?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                I would start by just creating an empty new conda environment and then install PySide2 in it so you can test it again.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  arsaa
                  wrote on last edited by
                  #7

                  OK. It's late in Moscow now. I will do this tomorrrow with fresh head to escape mistakes :-)

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    arsaa
                    wrote on last edited by arsaa
                    #8

                    Hi, SGaist.

                    1. I created a new conda environment according to this article
                      https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
                    2. I installed PySide2 in the new created environment
                      (qt_env) arsaa@arsaa-UL30A:~$ conda install -c conda-forge pyside2
                    3. Code I used in my first post was executed as expected in system console and in IPython console of Anaconda. No messages about errors.

                    Thanks a lot SGaist, your recommendations have solved the issue

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved