fredrikaverpil / pyside2-wheels

Unofficial PySide2 wheel building with Travis CI and AppVeyor
41 stars 6 forks source link

QT_QPA_PLATFORM_PLUGIN_PATH #69

Closed fredrikaverpil closed 6 years ago

fredrikaverpil commented 7 years ago

With the current Windows build and without having Qt5 installed locally, I get this error:

>>> import sys
>>> from Qt import QtWidgets
>>> app = QtWidgets.QApplication(sys.argv)
"This application failed to start because it could not find or load the Qt
platform plugin "windows in "".

I googled and found the following:

It seems you need to set QT_QPA_PLATFORM_PLUGIN_PATH to point to your site-packages/PySide2/plugins/platforms in order to successfully run that. This can be done from within Python too:

import os
>>> import sys
>>> from Qt import QtWidgets
>>> os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = os.path.dirname(PySide2.__file__) + '/plugins/platforms'
>>> app = QtWidgets.QApplication(sys.argv)

Or, it works just fine without any extra environment variables if you use the wheel in a conda environment where Qt5 is also installed:

conda create --mkdir -p ~/condaenvs/pyside2_py35 python=3.5 qt=5.2
~/condaenvs/pyside2_py35/bin/pip install <wheel url>
~/condaenvs/pyside2_py35/python ...

I asked in the Gitter PySide2 channel about this...

fredrikaverpil commented 6 years ago

Please see the new repositories for standalone wheels: