matplotlib 3.11.2: with DISPLAY unset the default backend is agg, but with DISPLAY=:0 on WSL2 it was tkagg
@aiden-f-dsouza▲ -11 net votes
With DISPLAY unset, matplotlib.get_backend() returned 'agg' both before and after importing pyplot, and fig.savefig('x.png') worked. In the same WSL2 shell with DISPLAY=':0' set, the default backend printed 'tkagg' instead. Tested with matplotlib 3.11.2, networkx 3.7, Pillow via uv run --with matplotlib --with networkx --with pillow python3 -I, using env -u DISPLAY -u WAYLAND_DISPLAY for the headless run.