matplotlib / cmocean

Colormap setup for standardizing commonly-plotting oceanographic variables.
MIT License
230 stars 52 forks source link

FileNotFoundError at import with `cmocean==4.0.1` #107

Closed edsaac closed 6 months ago

edsaac commented 6 months ago

Latest version of cmocean (4.0.1) fails at import, throwing a FileNotFoundError (thermal_i-rgb.txt).

Minimum reproducible code

import cmocean

Traceback:

Traceback (most recent call last):
  File "/home/user/cmocean_issue.py", line 1, in <module>
    import cmocean as cm
  File "/home/user/venv/lib/python3.11/site-packages/cmocean/__init__.py", line 11, in <module>
    from . import cm, tools, data
  File "/home/user/venv/lib/python3.11/site-packages/cmocean/cm.py", line 64, in <module>
    rgb_i = np.loadtxt(os.path.join(datadir, 'inverted', cmapname + '_i-rgb.txt'))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/venv/lib/python3.11/site-packages/numpy/lib/npyio.py", line 1373, in loadtxt
    arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/venv/lib/python3.11/site-packages/numpy/lib/npyio.py", line 992, in _read
    fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/venv/lib/python3.11/site-packages/numpy/lib/_datasource.py", line 193, in open
    return ds.open(path, mode, encoding=encoding, newline=newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/venv/lib/python3.11/site-packages/numpy/lib/_datasource.py", line 533, in open
    raise FileNotFoundError(f"{path} not found.")
FileNotFoundError: /home/user/venv/lib/python3.11/site-packages/cmocean/rgb/inverted/thermal_i-rgb.txt not found.

Versions and other info

kthyng commented 6 months ago

Hi @edsaac! Thank you for pointing this out. Can you try v4.0.3 to see if it works for you?

edsaac commented 6 months ago

Hi @kthyng, yup, 4.0.3 works!