Python qt.qpa.plugin: Could not find ... "xcb"

I have a python plotting script that used to work (I think) in a nix-sell environment. Today, the script dies with the following message:

Blockquote

$ nix-shell --pure develop.nix

[nix-shell:~/projects/nix_test]$ python science.py --show --velocity
qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “”
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

Blockquote

I think this is my first post to this site. Is this post appropriate? I could push my code to github or somewhere else. There are only two relevant files: develop.nix which defines the environment and science.py which makes simple plots. They are part of a project that documents my progress learning about Nix and my effort to use it to support reproducible research. The whole project has 10 other files that are not relevant to my problem today.

Thanks for any help/pointers,

Andy

I found a solution in another thread.. The solution is to add the following line to the definition of my development environment:

QT_QPA_PLATFORM_PLUGIN_PATH=“${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins”;

6 Likes

Was using this solution until Qt version 5.15.9. Now the subfolder platforms should be added to the path as in

QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins/platforms";