Wanted to give people a heads up about an issue I encountered using matplotlib and how I fixed it.
The Problem
When creating a figure using plt.figure
in a conda install of matplotlib I got the following error:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This seems to be a somewhat known issue, but I didn’t have time to do a deep dive on it.
My Workaround
Following some advice from this forum post on the NixOS discourse I decided to change the default backend for matplotlib to TKAgg.
Matplotlib’s Docs for changing defaults of this nature are here.
TLDR:
- You need to find your matplotlibrc file (see the link to get the exact path + caveats)
- Open the file, uncomment the existing line that says
##backend: Agg
and change it to saybackend: TKAgg
This worked for me.
“Proper” Solutions
If anyone knows how to address this issue in a better way I am all ears!
Edit: Just wanted to mention that I assume this is Aurora specific because of the Qt connection, if there’s a better place for the topic do let me know