From 25fe49a4fd8b1aff3753c60d8ca6d0f5d43b1b40 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 23 Jul 2020 13:02:15 +0200 Subject: [PATCH] Backport PR #18026: FIX: Be sure matplotlib.backends is imported before we use it --- lib/matplotlib/pyplot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 1314f055ec5d..4a172ade62b7 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -227,7 +227,8 @@ def switch_backend(newbackend): The name of the backend to use. """ global _backend_mod - + # make sure the init is pulled up so we can assign to it later + import matplotlib.backends close("all") if newbackend is rcsetup._auto_backend_sentinel: