All my attempts at using a Python module that requires Qt, fail with the dreaded
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
(and the, hilarious-in-Nix ‘Reinstalling the application may fix this problem.’) error message.
For example:
nix-shell \
--pure \
-I nixpkgs=https://github.com/NixOS/nixpkgs/archive/4d0ee90c6e253d40920f8dae5edb717a7d6f151d.tar.gz \
-p 'python38.withPackages(ps: with ps; [ pyqtgraph ])' \
--run "python -c 'import pyqtgraph as pg; pg.mkQApp()'"
crashes with the error
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.
/tmp/nix-shell-17747-0/rc: line 1: 20626 Aborted (core dumped) python -c 'import pyqtgraph as pg; pg.mkQApp()'
How can I get around this problem?
With the use of --pure
and the nailing down a specific version of nixpkgs
I would like to think that this is a hermetically sealed and fully reproducible instruction. Is this naive?
[ Aside: is there a flakes-enabled nix shell
equivalent of the old nix-shell
s ability to specify complex ‘packages’: -p 'python38.withPackages(ps: with ps; [ pyqtgraph ])'
? ]