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. Occur error when use "matplotlib" plotting after install 'PySide6'.
Forum Update on Monday, May 27th 2025

Occur error when use "matplotlib" plotting after install 'PySide6'.

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 1.9k 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.
  • W Offline
    W Offline
    Water.5
    wrote on 15 Aug 2022, 08:07 last edited by
    #1

    Test environment:
    OS: Windows
    Python: 3.10.6
    Matplotlib: 3.5.3

    After install "PySide6" via:
    python -m pip install pyside6

    import numpy as np
    import matplotlib.pyplot as plt
    a = np.array([1, 2, 3])
    plt.plot(a)
    

    Occur error below:

    • 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.

    https://github.com/matplotlib/matplotlib/issues/23613

    I try install "PySide2" on Windows, it's not have this issue.
    On Linux platform "PySide6" have not this issue.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      adrianghc
      wrote on 18 Aug 2022, 08:08 last edited by
      #2

      Hi and thank you for your post. I have not been able to reproduce your problem so far on a clean Python virtual environment set up only with numpy, matplotlib and pyside6. Could you share the following information:

      1. Have you installed Qt on your Windows machine?
      2. If so, is the environment QT_PLUGIN_PATH set on your system?
      3. If so, where does it point to and what are the contents of the "platforms" subdirectory?

      Can you also reproduce this error with a second virtual environment and with other Python versions?

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Water.5
        wrote on 18 Aug 2022, 18:47 last edited by
        #3

        Append, I think it isn't "matplotlib" issue, I test base function like below:

        import sys
        from PySide6.QtCore import Qt
        from PySide6.QtWidgets import QApplication, QLabel
        
        if __name__ == "__main__":
        	app = QApplication(sys.argv)
        	label = QLabel("Hello World", alignment=Qt.AlignCenter)
        	label.show()
        	sys.exit(app.exec_())
        
        

        Occur same error also, I have not installed Qt on Windows, and I try use "PySide2" instead "PySide6":

        import sys
        from PySide2.QtCore import Qt
        from PySide2.QtWidgets import QApplication, QLabel
        
        if __name__ == "__main__":
        	app = QApplication(sys.argv)
        	label = QLabel("Hello World", alignment=Qt.AlignCenter)
        	label.show()
        	sys.exit(app.exec_())
        
        

        Code works fine, "PySide2" not required Qt?

        qt_2.png

        I try install Qt open source on Windows, when start "Qt creator", occur this error:

        qt.png

        I install Qt on Windows 8.1, is it support?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          adrianghc
          wrote on 19 Aug 2022, 12:32 last edited by
          #4

          I just tried your new code on a clean Windows 11 sandbox containing no third-party software except Python with the PySide6 module, and it works. So if the Windows version is not the decisive factor here then it should work in principle on a clean environment.

          Was Qt ever installed on your system at some point? Even though you don't have Qt installed currently, please perform steps 2 and 3 from yesterday's post of mine nonetheless and let me know the results.

          Windows 8.1 is not officially supported for Qt 6: https://doc.qt.io/qt-6/windows.html However, this does not mean that it cannot work there. I'm not 100% sure on this, but I don't think that any of the technical differences between Windows 8.1 and later versions should affect this issue.

          1 Reply Last reply
          0

          1/4

          15 Aug 2022, 08:07

          • Login

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