proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.11k stars 102 forks source link

Can't import the package with Matplotlib 3.6? #394

Closed russellxie closed 2 years ago

russellxie commented 2 years ago

Description

I was just trying to import the package an seeing the following error message. Using Matplotlib 3.6.0 and Python 3.9. It seems that the package is looking for a attribute in matplotlib.cm that does not exist.

Steps to reproduce

# import proplot

Expected behavior: [What you expected to happen]

Actual behavior:



#AttributeError                            Traceback (most recent call last)
Cell In [1], line 33
31 import matplotlib
32 from matplotlib import pyplot as plt
---> 33 import proplot as pplt
34 import seaborn as sns
35 sns.set_context('talk')

File ~/.conda/envs/py39_pydsdb/lib/python3.9/site-packages/proplot/init.py:36 34 from .utils import # noqa: F401 F403 35 with _benchmark('colors'): ---> 36 from .colors import # noqa: F401 F403 37 with _benchmark('ticker'): 38 from .ticker import * # noqa: F401 F403

File ~/.conda/envs/py39_pydsdb/lib/python3.9/site-packages/proplot/colors.py:3111 3107 dict.setitem(self, key, value) 3110 # Initialize databases -> 3111 _cmap_database = _init_cmap_database() 3112 _color_database = _init_color_database() 3114 # Deprecated

File ~/.conda/envs/py39_pydsdb/lib/python3.9/site-packages/proplot/colors.py:2719, in _init_cmap_database() 2716 # WARNING: Skip over the matplotlib native duplicate entries 2717 # with suffixes '_r' and '_shifted'. 2718 attr = '_cmap_registry' if hasattr(mcm, '_cmap_registry') else 'cmap_d' -> 2719 database = getattr(mcm, attr) 2720 if mcm.get_cmap is not _get_cmap: 2721 mcm.get_cmap = _get_cmap

File ~/.conda/envs/py39_pydsdb/lib/python3.9/site-packages/matplotlib/_api/init.py:224, in caching_module_getattr..getattr(name) 222 if name in props: 223 return props[name].get(instance) --> 224 raise AttributeError( 225 f"module {cls.module!r} has no attribute {name!r}")

AttributeError: module 'matplotlib.cm' has no attribute 'cmap_d'


### Proplot version
matplotlib 3.6.0
proplot 0.9.5 (installed through pip)
python 3.9.0
russellxie commented 2 years ago

Found the answer in the other issue. I guess the package is only compatible with matplotlib 3.5 for now.

lukelbd commented 1 year ago

This is addressed in #309 -- haven't fixed dependency issues yet, but now installing proplot from scratch will at least enforce a compatible matplotlib version.