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

FileNotFoundError at import with cmocean==4.0.1 #107

Closed
edsaac opened this issue Apr 6, 2024 · 2 comments
Closed

FileNotFoundError at import with cmocean==4.0.1 #107

edsaac opened this issue Apr 6, 2024 · 2 comments

Comments

@edsaac
Copy link

edsaac commented Apr 6, 2024

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
@kthyng
Copy link
Contributor

kthyng commented Apr 6, 2024

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

@edsaac
Copy link
Author

edsaac commented Apr 6, 2024

Hi @kthyng, yup, 4.0.3 works!

@edsaac edsaac closed this as completed Apr 6, 2024
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