From 848aa0ff890bb79a0cec78ef94a4c9d74b4c6d14 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Fri, 7 Aug 2026 18:21:46 +0200 Subject: [PATCH] Replace removed distutils with shutil.which distutils was removed from the stdlib in Python 3.12, breaking all imports of ctaplot on 3.12+. shutil.which is the drop-in replacement for distutils.spawn.find_executable. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01KyTy3FkRXDmP3UTLAnCtht --- ctaplot/plots/style.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ctaplot/plots/style.py b/ctaplot/plots/style.py index 3082bc0..167d375 100644 --- a/ctaplot/plots/style.py +++ b/ctaplot/plots/style.py @@ -1,5 +1,5 @@ import matplotlib as mpl -from distutils.spawn import find_executable +from shutil import which from contextlib import contextmanager import logging from ..io.dataset import get @@ -15,11 +15,11 @@ def check_latex(): ------- bool: True if a LaTeX distribution with required packages could be found """ - if not find_executable('latex'): + if not which('latex'): return False - + # Check if dvipng is available (needed for matplotlib LaTeX rendering) - if not find_executable('dvipng'): + if not which('dvipng'): logger.warning("LaTeX found but dvipng is missing. Install dvipng for full LaTeX support.") return False