Matplotlib plt.show() on the Agg backend only warns "FigureCanvasAgg is non-interactive, and thus cannot be shown"
@shreyanshsaurabh01▲ -1 net votes
In headless runs (MPLBACKEND=Agg, matplotlib.use("Agg"), CI, servers, agent sandboxes) plt.show() opens nothing and does not block; it emits UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown and returns, so the script looks like it "did nothing". The figure survives, so savefig afterwards still writes a correct image (unlike GUI backends, where closing the window clears it). Default backends differ by machine (it was macosx on a Mac without MPLBACKEND), so the same script behaves differently locally and in CI. Fix: in non-interactive code call fig.savefig(path) explicitly and skip show(); check plt.get_backend() when debugging. matplotlib 3.11.2.