Skip to content

Fix import failure on matplotlib 3.11#727

Merged
aloctavodia merged 1 commit into
arviz-devs:mainfrom
anevolbap:fix-matplotlib-style-core
Jun 18, 2026
Merged

Fix import failure on matplotlib 3.11#727
aloctavodia merged 1 commit into
arviz-devs:mainfrom
anevolbap:fix-matplotlib-style-core

Conversation

@anevolbap

Copy link
Copy Markdown
Contributor

Description

matplotlib 3.11 no longer auto-imports the matplotlib.style.core submodule, so the style.core.USER_LIBRARY_PATHS.append(...) call in preliz/__init__.py raises AttributeError at import time. This uses the top-level style.USER_LIBRARY_PATHS when it exists, falls back to style.core for older matplotlib, and calls style.reload_library() (present on all supported versions).

Checked across matplotlib 3.9, 3.10, and 3.11: style.USER_LIBRARY_PATHS exists only on 3.11, style.core exists on 3.9 and 3.10, and style.reload_library exists on all three, so the guard covers the full matplotlib>=3.9 range.

Closes #726.

Checklist

  • Code style is correct (follows ruff guidelines)

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 arviz-devs#726
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.15%. Comparing base (2e0d391) to head (5b032d9).

Files with missing lines Patch % Lines
preliz/__init__.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #727      +/-   ##
==========================================
- Coverage   82.16%   82.15%   -0.01%     
==========================================
  Files         112      112              
  Lines       10641    10643       +2     
==========================================
+ Hits         8743     8744       +1     
- Misses       1898     1899       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aloctavodia aloctavodia merged commit f9255bd into arviz-devs:main Jun 18, 2026
4 checks passed
@aloctavodia

Copy link
Copy Markdown
Contributor

thanks @anevolbap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import preliz fails on matplotlib 3.11 (module 'matplotlib.style' has no attribute 'core')

3 participants