Occur error when use "matplotlib" plotting after install 'PySide6'.
-
wrote on 15 Aug 2022, 08:07 last edited by
Test environment:
OS: Windows
Python: 3.10.6
Matplotlib: 3.5.3After 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. - qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.
-
wrote on 18 Aug 2022, 08:08 last edited by
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:
- Have you installed Qt on your Windows machine?
- If so, is the environment QT_PLUGIN_PATH set on your system?
- 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?
-
wrote on 18 Aug 2022, 18:47 last edited by
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?
I try install Qt open source on Windows, when start "Qt creator", occur this error:
I install Qt on Windows 8.1, is it support?
-
wrote on 19 Aug 2022, 12:32 last edited by
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/4