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

AttributeError: module 'eccodes' has no attribute 'codes_grib_multi_support_reset_file' after the 0.9.9.0 release #227

Closed
nlhll opened this issue Apr 14, 2021 · 2 comments · Fixed by conda-forge/cfgrib-feedstock#22

Comments

@nlhll
Copy link

nlhll commented Apr 14, 2021

Hi there,

Worked fine on 0.9.8.5 version, however started throwing an AttributeError on the 0.9.9.0 one.
As an example:
cfgrib.open_dataset(file_path, backend_kwargs={"filter_by_keys": {"numberOfPoints": 2556, "typeOfLevel": "hybrid", "edition": 2, "level": 128}})

Can't create file 'INDEX_FILE.idx'
Traceback (most recent call last):
  File "../python/lib/python3.7/site-packages/cfgrib/messages.py", line 344, in from_indexpath_or_filestream
    self = cls.from_filestream(filestream, index_keys)
  File "../python/lib/python3.7/site-packages/cfgrib/messages.py", line 293, in from_filestream
    for message in filestream:
  File "../python/lib/python3.7/site-packages/cfgrib/messages.py", line 229, in __iter__
    with multi_enabled(file):
  File "../python/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "../python/lib/python3.7/site-packages/cfgrib/messages.py", line 51, in multi_enabled
    eccodes.codes_grib_multi_support_reset_file(file)
AttributeError: module 'eccodes' has no attribute 'codes_grib_multi_support_reset_file'
Can't read index file 'INDEX_FILE.idx'
Traceback (most recent call last):
  File "../python/lib/python3.7/site-packages/cfgrib/messages.py", line 353, in from_indexpath_or_filestream
    index_mtime = os.path.getmtime(indexpath)
  File "../python/lib/python3.7/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: 'INDEX_FILE.idx'

Any idea on what might be the cause of that?

@nlhll nlhll changed the title AttributeError: module 'eccodes' has no attribute 'codes_grib_multi_support_reset_file' after the 0.9.9.0 release AttributeError: module 'eccodes' has no attribute 'codes_grib_multi_support_reset_file' after the 0.9.9.0 release Apr 14, 2021
@alexamici
Copy link
Contributor

The latest version of cfgrib is compatible only with fairly new version of the eccodes python package, but I failed to add this minimum version in the setup.py. I'll add it and make a new release.

As a work-around you need to update the package with ecCodes python bindings depending on you install setup. This is different for pip, conda and other installation strategies.

Thanks for the report.

@xigrug
Copy link

xigrug commented Jun 29, 2021

I also have this question :
ds = xr.open_dataset("C:\\Users\\liuc\\Downloads\\era5-levels-members.grib", engine="cfgrib")

W:\software\anaconda\lib\site-packages\cfgrib\messages.py in multi_enabled(file)
49 # @alexamici: I'm note sure this is thread-safe. See :#141
50 #
---> 51 eccodes.codes_grib_multi_support_reset_file(file)
52 try:
53 yield

AttributeError: module 'eccodes' has no attribute 'codes_grib_multi_support_reset_file'

Name Version Build Channel

eccodes 2.14.1 hbda0969_1 conda-forge
python-eccodes 0.9.3 py38hc8d92b1_1 conda-forge
xarray 0.18.0 pyhd3eb1b0_1

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

Successfully merging a pull request may close this issue.

3 participants