3

I'm trying to run qgis_process on WSL2 on Windows 10 using Ubuntu and I get this Error message:

qt.qpa.xcb: could not connect to display xxx.xxx.xxx.x:x
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

The same thing happens when I run QGIS from the command line, but with qgis_process loading a GUI doesnt make sense, because I want it to run in the command line only. Im using QGIS 3.24.1. I already uninstalled my old QGIS version and installed the new one, and it didnt help.

I'm not so familiar with Linux.

1 Answer 1

5

It is unfortunately not entirely clear from your question how you are calling qgis_process, but I'm attempting to answer anyways because I did run into the exact error before.

If you want to call the qgis_process which comes with your windows installation of QGIS you should run qgis_process from within the OSGeo4W shell. Running via WSL2 will work with following command (but then again I don't know why you would be using WSL for this, you could just aswell run the command in cmd)

cmd.exe /c OSGeo4W.bat qgis_process-qgis list

Note the -qgis suffix in the command.

However, from your error message and because you are using WSL I assume that you might be running one of the QGIS docker images inside WSL2. That's atleast where I stumbled across the error by running something like the below command, which results in exactly the error you mentioned.

$ docker exec -it qgis_test sh -c "qgis_process list"
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, xcb.

Aborted

To solve this you need to tell QGIS to run in a headless context (meaning without graphical display).

This can be achieved by setting the the QT_QPA_PLATFORM environment variable:

export QT_QPA_PLATFORM="offscreen" && qgis_process list

Or another option would be to use a virtual framebuffer as display output:

export DISPLAY=:99 && qgis_process list
1
  • Thanks a lot, this helped: "export QT_QPA_PLATFORM="offscreen" && qgis_process list". Im running qgis_process within the WLS2 terminal, so I can use other linux tools and applications, while coding within windows. For qgis im not using docker, but installed it normally. Commented Apr 3, 2022 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.