I've recently installed PySide 6. I'm running Ubuntu 20.04 Attempting to run my code on VSCode And have just ran: export QT_DEBUG_PLUGINS=1
I'm getting the following message:
QFactoryLoader::QFactoryLoader() checking directory path "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqeglfs.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archreq": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archreq": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqminimal.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("minimal")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqminimalegl.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archreq": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("minimalegl")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archreq": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqvnc.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archreq": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("vnc")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-egl.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-egl"
]
},
"archreq": 0,
"className": "QWaylandEglPlatformIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("wayland-egl")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-generic.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-generic.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archreq": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("wayland")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-xcomposite-egl.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-egl"
]
},
"archreq": 0,
"className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("wayland-xcomposite-egl")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-xcomposite-glx.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-glx"
]
},
"archreq": 0,
"className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("wayland-xcomposite-glx")
QFactoryLoader::QFactoryLoader() looking at "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqxcb.so"
Found metadata in lib /home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archreq": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 393216
}
Got keys from plugin meta data QList("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/omari/anaconda3/envs/gui_projects/bin/platforms" ...
loaded library "/home/omari/anaconda3/envs/gui_projects/lib/python3.8/site-packages/PySide6/Qt/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
I've uninstalled and reinstalled PySide 6 and am still unable to get it to run. I'm not sure what I'm missing in that message as to what I need to do.
The code I'm trying to run is:
import sys
import random
from PySide6 import QtCore, QtWidgets, QtGui
class MyWidget(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"]
self.button = QtWidgets.QPushButton("Click me!")
self.text = QtWidgets.QLabel("Hello World",
alignment=QtCore.Qt.AlignCenter)
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.text)
self.layout.addWidget(self.button)
self.setLayout(self.layout)
self.button.clicked.connect(self.magic)
@QtCore.Slot()
def magic(self):
self.text.setText(random.choice(self.hello))
if __name__ == "__main__":
app = QtWidgets.QApplication([])
widget = MyWidget()
widget.resize(800, 600)
widget.show()
sys.exit(app.exec_())
Which is only the "Create a simple application" copy and pasted directly from the website.
Any ideas on a fix? Or more information needed?
I have yet to come across any solutions from qt.io's forums, or any other articles pertaining to this issue.
EDIT
So far I've come across one work around. I can open the file directly from the terminal. It still isn't working when trying to run through VSCode though.
EDIT2
There's a chance this can be a VSCode Extension issue. PySide, or QT for that matter, saves files in .ui. My code here is in .py. When changing it to .ui VSCode was prompting me for the proper extension to open it with. I haven't opened it yet, but I believe that to be how I should be looking at this. For it to open in the terminal, but not VSCode, tells me that it's something VSCode doesn't have.