Question: I am working on Ubuntu 18.04 (as a Windows 10 subsystem for linux).
When I try running code that uses pyqt5 it throws the error:

"
qt.qta.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, xcb.

Aborted
"

as in the image [image of error message](https://i.stack.imgur.com/veoyT.png) (the error is definitely connected to pyqt5).
I have found many posts that suggest to:

1. Go to => Python38>lib>site-packages>PyQt5>Qt>plugins
2. In plugins copy platforms folder
3. After that go to Python38>lib>site-packages>PyQt5\_tools>Qt>bin
4. paste folder here. Do copy and replace.

but it seems like there is no Qt folder in pyqt5\_tools on my computer.
I have removed and installed back pyqt5, pyqt5-tools, pyqt5-plugins several times but it does not work. Can it be connected to the fact that I am using a subsystem? (I have downloaded pyqt5 both on Windows and on Ubuntu). Any suggestions to solve this problem?

Answer: 
The error relates to a missing requirement for one or multiple XCB-related libraries, which needs to be fulfilled on X11 for Qt to function properly. For a full list of XCB libraries check [here](https://doc.qt.io/qt-5/linux-requirements.html).

I would suggest that, instead of copying files left and right, you first try reinstalling PyQt5 via `pip`. I've had a similar experience with `conda`, where PySided2 was not working due to a missing `shiboken`, which I had to install via `pip`.

In addition you may want to try `conda` (e.g. Anaconda or Miniconda). Last but not least, if this is the only problem you have, you may attempt to install the required XCB libraries. This is however tricky, since the version your distro provides may be different from the rest that the `pip` installation has.

A safe way for installing PyQt5 is simply using the package manager of your distro inside WSL. Since it's a virtualized system I'd assume that it's created solely for the purpose of working on a PyQt5 project and after that it will be deleted. Tainting the clean initial setup should therefor not be an issue.
I had the same issue, Ubuntu 18 on WSL as well.

I solved following @rbaleksandar's suggestion.

```
conda install -c anaconda pyqt

```