When I try to show a matplotlib
window from Python 3 via show()
I get the following error:
UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
So following various threads here on SO I tried the following:
import matplotlib
matplotlib.use("TkAgg")
Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
I also tried it with matplotlib.use("QtAgg")
, which leads to a similar error:
Cannot load backend 'QtAgg' which requires the 'qt' interactive framework, as 'headless' is currently running
So it seems regardless of what backend I try, matplotlib
thinks its in headless mode. However, I can run other X apps from that WSL installation under Win11 just fine, for example xclock
or sqlitebrowser
. They all work with the X server built into Win11. The DISPLAY
env. variable is set to:
$ echo $DISPLAY
:0
Any ideas how I can get matplotlib
windows working under Win11?