From 24403e0474273a255f541a7ae69fe8778d37b395 Mon Sep 17 00:00:00 2001 From: Giorgio Gilestro Date: Fri, 1 May 2026 12:23:15 +0100 Subject: [PATCH] Force interactive matplotlib backend in pick_barrier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some environments default matplotlib to Agg (non-interactive), which silently no-ops plt.show() — the picker would print "FigureCanvasAgg is non-interactive" and never display the thumbnail grid. Probe TkAgg > QtAgg > Qt5Agg > GTK3Agg before pyplot import. Co-Authored-By: Claude Opus 4.7 --- scripts/pick_barrier.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/pick_barrier.py b/scripts/pick_barrier.py index 8e5ec54..be63d5a 100644 --- a/scripts/pick_barrier.py +++ b/scripts/pick_barrier.py @@ -41,6 +41,17 @@ import sys from pathlib import Path import cv2 +import matplotlib +# Reason: force an interactive backend so plt.show() actually opens a window. +# Some environments (depending on matplotlibrc / DISPLAY / installed Qt-vs-Tk +# bindings) default to Agg, which silently no-ops the picker. Try the common +# GUI backends in order; fall through to whatever is set if none are available. +for _backend in ("TkAgg", "QtAgg", "Qt5Agg", "GTK3Agg"): + try: + matplotlib.use(_backend, force=True) + break + except (ImportError, ValueError): + continue import matplotlib.pyplot as plt import numpy as np import pandas as pd