Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PySide6 does not work with Anaconda
Forum Updated to NodeBB v4.3 + New Features

PySide6 does not work with Anaconda

Scheduled Pinned Locked Moved Solved Qt for Python
13 Posts 3 Posters 7.8k Views 2 Watching
  • 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.
  • J Offline
    J Offline
    Johan_R
    wrote on last edited by
    #1

    I tested running a simple hello world program

    import sys
    from PySide6.QtWidgets import QApplication, QLabel
    
    app = QApplication(sys.argv)
    label = QLabel("Hello World!")
    label.show()
    app.exec()
    

    I'm using Windows 10 and PySide6 (6.2.2.1). I tested with

    Plain Python 3.7
    Plain Python 3.8
    Plain Python 3.9
    Plain Python 3.10
    Anaconda with Python 3.8
    Anaconda with Python 3.9
    

    It works as expected with plain Python 3.7, 3.8, 3.9 and 3.10.
    But with Anaconda with Python 3.8 and 3.9 I get the error message

    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll: Invalid metadata version
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll: Invalid metadata version
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll: Invalid metadata version
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll: Invalid metadata version
    qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    

    Running with QT_DEBUG_PLUGINS=1 I get the error message

    3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Rade/anaconda3/Library/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll"
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll: Invalid metadata version
    "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll'"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll"
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll: Invalid metadata version
    "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll'"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll"
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll: Invalid metadata version
    "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll'"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll"
    Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll: Invalid metadata version
    "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll'"
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Rade/anaconda3/platforms" ...
    qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    

    I need Anaconda as I am developing a data analysis and visualization app.
    Any idea how I might fix this?

    JonBJ 2 Replies Last reply
    0
    • J Johan_R

      I tested running a simple hello world program

      import sys
      from PySide6.QtWidgets import QApplication, QLabel
      
      app = QApplication(sys.argv)
      label = QLabel("Hello World!")
      label.show()
      app.exec()
      

      I'm using Windows 10 and PySide6 (6.2.2.1). I tested with

      Plain Python 3.7
      Plain Python 3.8
      Plain Python 3.9
      Plain Python 3.10
      Anaconda with Python 3.8
      Anaconda with Python 3.9
      

      It works as expected with plain Python 3.7, 3.8, 3.9 and 3.10.
      But with Anaconda with Python 3.8 and 3.9 I get the error message

      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll: Invalid metadata version
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll: Invalid metadata version
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll: Invalid metadata version
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll: Invalid metadata version
      qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
      This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
      

      Running with QT_DEBUG_PLUGINS=1 I get the error message

      3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
      QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Rade/anaconda3/Library/plugins/platforms" ...
      QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll"
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll: Invalid metadata version
      "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll'"
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll"
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll: Invalid metadata version
      "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll'"
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll"
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll: Invalid metadata version
      "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll'"
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll"
      Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll: Invalid metadata version
      "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll'"
      not a plugin
      QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Rade/anaconda3/platforms" ...
      qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
      This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
      

      I need Anaconda as I am developing a data analysis and visualization app.
      Any idea how I might fix this?

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

      @Johan_R
      I think this is indeed some anaconda issue, and you will struggle to get a definitive answer here from what I have seen. Googling qt "Invalid metadata version" anaconda does not reveal many hits. I would suggest you look through the long post at https://github.com/ContinuumIO/anaconda-issues/issues/1270. I know it's from 2016 but it's the best I could find. Suggestions seem to revolve around what your PATH is, and to at least try copying these anaconda libraries to a different location in the anaconda area? I think you will have to try some play experimenting....

      J 1 Reply Last reply
      2
      • J Johan_R

        I tested running a simple hello world program

        import sys
        from PySide6.QtWidgets import QApplication, QLabel
        
        app = QApplication(sys.argv)
        label = QLabel("Hello World!")
        label.show()
        app.exec()
        

        I'm using Windows 10 and PySide6 (6.2.2.1). I tested with

        Plain Python 3.7
        Plain Python 3.8
        Plain Python 3.9
        Plain Python 3.10
        Anaconda with Python 3.8
        Anaconda with Python 3.9
        

        It works as expected with plain Python 3.7, 3.8, 3.9 and 3.10.
        But with Anaconda with Python 3.8 and 3.9 I get the error message

        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll: Invalid metadata version
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll: Invalid metadata version
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll: Invalid metadata version
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll: Invalid metadata version
        qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
        This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
        

        Running with QT_DEBUG_PLUGINS=1 I get the error message

        3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
        QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Rade/anaconda3/Library/plugins/platforms" ...
        QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll"
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll: Invalid metadata version
        "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qdirect2d.dll'"
        not a plugin
        QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll"
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll: Invalid metadata version
        "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qminimal.dll'"
        not a plugin
        QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll"
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll: Invalid metadata version
        "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qoffscreen.dll'"
        not a plugin
        QFactoryLoader::QFactoryLoader() looking at "C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll"
        Found invalid metadata in lib C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll: Invalid metadata version
        "Failed to extract plugin meta data from 'C:/Users/Rade/anaconda3/Library/plugins/platforms/qwindows.dll'"
        not a plugin
        QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Rade/anaconda3/platforms" ...
        qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
        This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
        

        I need Anaconda as I am developing a data analysis and visualization app.
        Any idea how I might fix this?

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

        @Johan_R
        A further two posts seem to be the same issue as you are facing:

        • https://stackoverflow.com/questions/68006243/how-to-install-pyside6
        • https://stackoverflow.com/questions/51367446/pyside2-application-failed-to-start/51563781#51563781

        Not sure whether they contain resolutions, but again worth reading.

        Sometimes user @eyllanesc is around on this forum (as well as on stackoverflow) and sees a post such as this, that user is a Qt-Python expert, might see this and respond....

        1 Reply Last reply
        2
        • JonBJ JonB

          @Johan_R
          I think this is indeed some anaconda issue, and you will struggle to get a definitive answer here from what I have seen. Googling qt "Invalid metadata version" anaconda does not reveal many hits. I would suggest you look through the long post at https://github.com/ContinuumIO/anaconda-issues/issues/1270. I know it's from 2016 but it's the best I could find. Suggestions seem to revolve around what your PATH is, and to at least try copying these anaconda libraries to a different location in the anaconda area? I think you will have to try some play experimenting....

          J Offline
          J Offline
          Johan_R
          wrote on last edited by
          #4

          @JonB said in PySide6 does not work with Anaconda:

          https://github.com/ContinuumIO/anaconda-issues/issues/1270

          Thanks for taking the time too look into this. I tried some of the remedies proposed in that thread but with no success so far. I do not think it is the same issue. That thread deals with the situation that the platform plugins are not found at all. The thread does not mention metadata at all. In my case they are found but the metadata is somehow invalid which suggests that something else has gone wrong earlier.

          JonBJ 1 Reply Last reply
          0
          • J Johan_R

            @JonB said in PySide6 does not work with Anaconda:

            https://github.com/ContinuumIO/anaconda-issues/issues/1270

            Thanks for taking the time too look into this. I tried some of the remedies proposed in that thread but with no success so far. I do not think it is the same issue. That thread deals with the situation that the platform plugins are not found at all. The thread does not mention metadata at all. In my case they are found but the metadata is somehow invalid which suggests that something else has gone wrong earlier.

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

            @Johan_R
            You may well be right. The idea was to read to figure what gets what from where.

            This is my last wild suggestion, because obviously I don't know. You say it works outside anaconda but not inside anaconda. Presumably those anaconda3/Library/plugins/platforms/q*.dll exist somewhere else not inside the anaconda area? Assuming so: compare some of the files. I suppose they are different? Are the anaconda ones the same architecture, I'm thinking they need to be 64-bit not 32-bit? What if you temporarily make yours use the non-anaconda ones, either by some PATH or whatever manipulation, or just by temporarily copying/renaming so that directory contains non-anaconda ones? Just an idea, to try to diagnose....

            J 1 Reply Last reply
            1
            • JonBJ JonB

              @Johan_R
              You may well be right. The idea was to read to figure what gets what from where.

              This is my last wild suggestion, because obviously I don't know. You say it works outside anaconda but not inside anaconda. Presumably those anaconda3/Library/plugins/platforms/q*.dll exist somewhere else not inside the anaconda area? Assuming so: compare some of the files. I suppose they are different? Are the anaconda ones the same architecture, I'm thinking they need to be 64-bit not 32-bit? What if you temporarily make yours use the non-anaconda ones, either by some PATH or whatever manipulation, or just by temporarily copying/renaming so that directory contains non-anaconda ones? Just an idea, to try to diagnose....

              J Offline
              J Offline
              Johan_R
              wrote on last edited by
              #6

              I tried with MIniconda instead of Anaconda.
              (Miniconda is minimal conda version. It includes only conda, Python,and a small number of other usefu l packages. One can then install additional conda packages from the conda repository.)

              Miniconda + PySide6 works. It still works after I install numpy and pandas. But when I install matpotlib it stops working, with the same error message as before. So it seems that PySide6 is not compatible with matplotlib.

              Thanks for the help @JonB. I'll ask about this in a matplotlib forum.

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

                Hi,

                It's rather the other way around. Anaconda might not be providing a Matplotlib release with a backend for PySide6.

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

                J 1 Reply Last reply
                1
                • SGaistS SGaist

                  Hi,

                  It's rather the other way around. Anaconda might not be providing a Matplotlib release with a backend for PySide6.

                  J Offline
                  J Offline
                  Johan_R
                  wrote on last edited by Johan_R
                  #8

                  @SGaist I tried with PySide2 instead of Pyside6. I used a fresh Miniconda installation and I ran a PySide2 version of the Hello World program above.
                  Same behavior as before. It works with Miniconda + PySide2, keeps working after I install numpy and pandas, and stops working when I install matplotlib. The error message is almost the same as before

                  qt.qpa.plugin: Could not load the Qt platform plugin "windows" 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: direct2d, minimal, offscreen, windows.
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Can you check where the plugins are loaded from before and after installing matplotlib ?

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

                    J 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      Can you check where the plugins are loaded from before and after installing matplotlib ?

                      J Offline
                      J Offline
                      Johan_R
                      wrote on last edited by Johan_R
                      #10

                      @SGaist

                      Before:
                      C:\Users\Rade\miniconda3\Lib\site-packages\PySide2\plugins\platforms\qwindows.dll

                      After:
                      C:\Users\Rade\miniconda3\Library\plugins\platforms\qwindows.dll

                      The folder C:\Users\Rade\miniconda3\Library\plugins does not exist before matplotlib is installed

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

                        Then looks like it comes with its own build of Qt and they clash with the one of PySide2.

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

                        J 2 Replies Last reply
                        1
                        • SGaistS SGaist

                          Then looks like it comes with its own build of Qt and they clash with the one of PySide2.

                          J Offline
                          J Offline
                          Johan_R
                          wrote on last edited by
                          #12
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Then looks like it comes with its own build of Qt and they clash with the one of PySide2.

                            J Offline
                            J Offline
                            Johan_R
                            wrote on last edited by Johan_R
                            #13

                            @SGaist You are absolutely right. matplotlib comes bundled with PySide6. If I install matplotlib and do not install my own PySide6, then the above Hello World program runs as expected. Problem solved.

                            Many thanks to @JonB and @SGaist for helping out with this!

                            1 Reply Last reply
                            1

                            • Login

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