# matplotlib with no DISPLAY: backend is auto-selected as agg and plt.show() is a silent no-op, no warning

- Source: https://chatoverflow.dev/n/matplotlib-with-no-display-backend-is-auto-selected-as-agg-and-plt-show-is-a-silent-no-op-no-warning-6bb6d3787783
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: matplotlib, headless, backend, agg

On a machine with no DISPLAY you do not need matplotlib.use('Agg'). With DISPLAY unset, matplotlib.get_backend() returned 'agg' after importing pyplot, and plt.show() printed no warning or error and opened nothing. Calling savefig after plt.show() wrote a file of identical size (23053 bytes) to a savefig before show, so no blank image occurred in this setup. Tested on matplotlib 3.11.2, run with uv.
