matplotlib / matplotlib/cmocean

wrong version of matplotlib?

Open
#115 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
269
Forks
54
PR merge metrics
No merged PRs in 30d

Description

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[27], line 1
----> 1 import cmocean

File ~/opt/anaconda3/lib/python3.9/site-packages/cmocean/__init__.py:11
8 from __future__ import absolute_import
10 # from cmocean import *
---> 11 from . import cm, tools, data
13 __all__ = ['cm',
14 'tools',
15 'plots',
16 'data']
18 __authors__ = ['Kristen Thyng ']

File ~/opt/anaconda3/lib/python3.9/site-packages/cmocean/cm.py:34
30 cmap_d = dict()
33 # a comparable version object
---> 34 MPL_VERSION = Version(version("matplotlib"))
36 def _register_cmap(cmap, *, name):
37 # wrap matplotlib.cm API, use non-deprecated API when available
38 if MPL_VERSION >= Version("3.5"):

File ~/opt/anaconda3/lib/python3.9/site-packages/packaging/version.py:196, in Version.__init__(self, version)
185 """Initialize a Version object.
186
187 :param version:
(...)
192 exception will be raised.
193 """
195 # Validate the version and parse it into pieces
--> 196 match = self._regex.search(version)
197 if not match:
198 raise InvalidVersion(f"Invalid version: '{version}'")

TypeError: expected string or bytes-like object

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the import failure in the Python 3.9 Anaconda environment shown, then inspect cmocean/cm.py around the MPL_VERSION assignment and the matplotlib version lookup. Done means importing cmocean no longer raises the reported TypeError with the relevant matplotlib installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.