Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error due to removal of get_cmap in matplotlib 3.9 #79

Open
aecio opened this issue May 23, 2024 · 1 comment
Open

Error due to removal of get_cmap in matplotlib 3.9 #79

aecio opened this issue May 23, 2024 · 1 comment

Comments

@aecio
Copy link

aecio commented May 23, 2024

PolyFuzz is being installed as a transitive dependency, and I'm getting the following error due to the removal of matplotlib.cm.get_cmap in matplotlib 3.9.

 /opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/polyfuzz/__init__.py:1: in <module>
    from .polyfuzz import PolyFuzz
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/polyfuzz/polyfuzz.py:9: in <module>
    from polyfuzz.metrics import precision_recall_curve, visualize_precision_recall
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/polyfuzz/metrics.py:8: in <module>
    from matplotlib.cm import get_cmap
E   ImportError: cannot import name 'get_cmap' from 'matplotlib.cm' (/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/matplotlib/cm.py)

The removal is described in https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.9.0.html#removals, and the suggested fix is as follows:

use matplotlib.colormaps[name] instead if you have a str. Use matplotlib.cm.ColormapRegistry.get_cmap if you have a str, None or a matplotlib.colors.Colormap object that you want to convert to a Colormap object.

@MaartenGr
Copy link
Owner

Thanks for sharing! There is already a PR open that considers this: #78

As soon as some changes are made there, I'll make sure to up the version.

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

No branches or pull requests

2 participants