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

mpl incompatibility on ChatGPT #2317

Open
twiecki opened this issue Feb 26, 2024 · 2 comments
Open

mpl incompatibility on ChatGPT #2317

twiecki opened this issue Feb 26, 2024 · 2 comments

Comments

@twiecki
Copy link
Contributor

twiecki commented Feb 26, 2024

Trying to import arviz on ChatGPT leads to:

----> 3     import arviz as az
      4     result = "ArviZ is available."
      5 except ImportError:

File ~/.local/lib/python3.8/site-packages/arviz/__init__.py:324
    322     import colorcet
    323 except ModuleNotFoundError:
--> 324     _mpl_cm("gray", _linear_grey_10_95_c0)
    325     _mpl_cm("gray_r", list(reversed(_linear_grey_10_95_c0)))
    328 # clean namespace

File ~/.local/lib/python3.8/site-packages/arviz/__init__.py:318, in _mpl_cm(name, colorlist)
    316 def _mpl_cm(name, colorlist):
    317     cmap = LinearSegmentedColormap.from_list(name, colorlist, N=256)
--> 318     mpl.colormaps.register(cmap, name="cet_" + name)

AttributeError: module 'matplotlib' has no attribute 'colormaps'

I bet the env has an incompatible matplotlib version (installed is 3.4.3.) but I'm wondering if there's an easy way to maybe make it compatible.

@OriolAbril
Copy link
Member

The minimum mpl version required for ArviZ is 3.5, when the colormaps module was added, not sure how that env came to be. Is is possible to update matplotlib somehow?

Another alternative would be to avoid triggering that try except, which wouldn't be triggered if colorcet were installed.

@twiecki
Copy link
Contributor Author

twiecki commented Feb 26, 2024

It's just whatever openai cobbled together I guess.

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