PySide6 does not work with Anaconda
-
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 messageFound 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? -
@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. Googlingqt "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 yourPATH
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.... -
@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....
-
@JonB said in PySide6 does not work with Anaconda:
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.
-
@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 somePATH
or whatever manipulation, or just by temporarily copying/renaming so that directory contains non-anaconda ones? Just an idea, to try to diagnose.... -
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.
-
Hi,
It's rather the other way around. Anaconda might not be providing a Matplotlib release with a backend for PySide6.
-
@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 beforeqt.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.
-
Can you check where the plugins are loaded from before and after installing matplotlib ?
-
Before:
C:\Users\Rade\miniconda3\Lib\site-packages\PySide2\plugins\platforms\qwindows.dllAfter:
C:\Users\Rade\miniconda3\Library\plugins\platforms\qwindows.dllThe folder C:\Users\Rade\miniconda3\Library\plugins does not exist before matplotlib is installed
-
Then looks like it comes with its own build of Qt and they clash with the one of PySide2.
-