MaartenGr / MaartenGr/PolyFuzz
Error due to removal of `get_cmap` in matplotlib 3.9
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 803
- Forks
- 72
- PR merge metrics
- No merged PRs in 30d
Description
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
from .polyfuzz import PolyFuzz
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/polyfuzz/polyfuzz.py:9: in
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
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](https://docs.python.org/3/library/stdtypes.html#str). Use [matplotlib.cm.ColormapRegistry.get_cmap](https://matplotlib.org/stable/api/cm_api.html#matplotlib.cm.ColormapRegistry.get_cmap) if you have a [str](https://docs.python.org/3/library/stdtypes.html#str), [None](https://docs.python.org/3/library/constants.html#None) or a [matplotlib.colors.Colormap](https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap) object that you want to convert to a [Colormap](https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap) object.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in polyfuzz/metrics.py, where the traceback identifies the removed matplotlib.cm.get_cmap import, and read the linked Matplotlib 3.9 API-removal guidance. Verify that PolyFuzz imports successfully with Matplotlib 3.9 and that the existing metrics behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100