Pyside2 application failed to start
Pyside2 application failed to start
I just tried to test the newly released version of pyside2 (5.11) on Windows 10, 64bit version. But the "Hello World" example does not work. I am using Python 3.6 with PyCharm.The interpreter I use is from Anaconda. So I pip installed the pyside2 version and also tried to install via "conda install ..." the older version of pyside2. Both installations worked, but I get the same error message for both libraries.
The error message is pooping up in a separate secreen saying:" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: minimal, offscreen, windows."
So I definetly can see the plugin files in the correct folder. I tried reinstalling. Deleted everything and tried other IDEs. But nothing solved the problem.
Any help appreciated.
1 Answer
1
If you run the app after having set QT_DEBUG_PLUGINS=1
, you should get more info on what is the issue. In my case, I was getting:
set QT_DEBUG_PLUGINS=1
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/xxxxx/AppData/Local/py3/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/xxxxx/AppData/Local/py3/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
Such a folder does not exist on my machine.
There are a couple of tickets related to a similar issue (not sure it is the same problem):
As a workaround, I have added the right path directly into the code (using QCoreApplication.addLibraryPath
), it works in my case:
QCoreApplication.addLibraryPath
import sys, os
from PySide2 import QtCore, QtGui, QtWidgets
def main():
QtCore.QCoreApplication.addLibraryPath(os.path.join(os.path.dirname(QtCore.__file__), "plugins"))
app = QtWidgets.QApplication()
main_win = QtWidgets.QMainWindow()
main_win.show()
sys.exit(app.exec_())
A similar solution is described here: How to get path of a python module ( not sys.executable )
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.