I just built a python environment on wsl the other day, and I didn't run a program that included a GUI, so when I tried it, I got stuck with an error, so I'll leave a memorandum of how to deal with it.
What I was trying to run was a GUI program using PyQt5. It also includes drawing with matplotlib. In the Anaconda environment, it is a program that can be executed without any additional settings.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
When I ran the program, I got the above error.
When I looked it up, there was a person who encountered a similar situation.
[\ qt \ .qpa \ .plugin: Could not load the Qt platform plugin" xcb "in" "even though it was found \. \
What to do when the error occurs -Qiita](https: // qiita.com/fukasawah/items/99219e1ff7d08915952f)
I did the following:
sudo apt install libxkbcommon-x11-0
However, before executing this, the following is carried out.
When executing a program that includes a GUI such as matplotlib, it is necessary to start Xserver. If you run it without starting it, you will get the following error.
qt.qpa.xcb: could not connect to display :0.0
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, webgl, xcb.
Aborted (core dumped)
There may be unnecessary parts, but in my case this was the solution. For your reference.
Recommended Posts