Skip to content

FileNotFoundError at import with cmocean==4.0.1 #107

Description

@edsaac

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

  • python==3.11.8
  • matplotlib==3.8.4
  • cmocean==4.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions