From 5b032d9907255ab27b22cd1558edc91d2b33586d Mon Sep 17 00:00:00 2001 From: anevolbap Date: Thu, 18 Jun 2026 04:23:33 -0400 Subject: [PATCH] Fix import failure on matplotlib 3.11 matplotlib 3.11 no longer auto-imports matplotlib.style.core, so style.core.USER_LIBRARY_PATHS raised AttributeError at import time. Use the top-level style.USER_LIBRARY_PATHS when present, fall back to style.core for older matplotlib, and call style.reload_library(). Closes #726 --- preliz/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/preliz/__init__.py b/preliz/__init__.py index 31f3b280..73aa7ebe 100644 --- a/preliz/__init__.py +++ b/preliz/__init__.py @@ -29,8 +29,11 @@ # add PreliZ's styles to matplotlib's styles _preliz_style_path = os_path.join(os_path.dirname(__file__), "styles") -style.core.USER_LIBRARY_PATHS.append(_preliz_style_path) -style.core.reload_library() +if hasattr(style, "USER_LIBRARY_PATHS"): + style.USER_LIBRARY_PATHS.append(_preliz_style_path) +else: + style.core.USER_LIBRARY_PATHS.append(_preliz_style_path) +style.reload_library() # clean namespace del os_path, mpl_rcParams, _preliz_style_path