html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/7884#issuecomment-1572276996,https://api.github.com/repos/pydata/xarray/issues/7884,1572276996,IC_kwDOAMm_X85dtwsE,2448579,2023-06-01T15:30:26Z,2023-06-01T15:30:26Z,MEMBER,Please ask over at the cfgrib repo. But it does look like a bad environment / bad install.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1571684058,https://api.github.com/repos/pydata/xarray/issues/7884,1571684058,IC_kwDOAMm_X85drf7a,48015835,2023-06-01T09:29:13Z,2023-06-01T09:29:13Z,NONE,"Just running `import cfgrib` returns the error below. But this works for you?
Is this an issue that cannot be solved?
Thanks again for all your help!
```
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[32], line 1
----> 1 import cfgrib
File ~\Anaconda3\envs\doom_test\lib\site-packages\cfgrib\__init__.py:20
18 # cfgrib core API depends on the ECMWF ecCodes C-library only
19 from .abc import Field, Fieldset, Index, MappingFieldset
---> 20 from .cfmessage import COMPUTED_KEYS
21 from .dataset import (
22 Dataset,
23 DatasetBuildError,
(...)
27 open_from_index,
28 )
29 from .messages import FieldsetIndex, FileStream, Message
File ~\Anaconda3\envs\doom_test\lib\site-packages\cfgrib\cfmessage.py:29
26 import attr
27 import numpy as np
---> 29 from . import abc, messages
31 LOG = logging.getLogger(__name__)
33 # taken from eccodes stepUnits.table
File ~\Anaconda3\envs\doom_test\lib\site-packages\cfgrib\messages.py:28
25 import typing as T
27 import attr
---> 28 import eccodes # type: ignore
29 import numpy as np
31 from . import abc
File ~\Anaconda3\envs\doom_test\lib\site-packages\eccodes\__init__.py:13
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 13 from .eccodes import * # noqa
14 from .highlevel import *
File ~\Anaconda3\envs\doom_test\lib\site-packages\eccodes\eccodes.py:12
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 12 from gribapi import (
13 CODES_PRODUCT_ANY,
14 CODES_PRODUCT_BUFR,
15 CODES_PRODUCT_GRIB,
16 CODES_PRODUCT_GTS,
17 CODES_PRODUCT_METAR,
18 )
19 from gribapi import GRIB_CHECK as CODES_CHECK
20 from gribapi import GRIB_MISSING_DOUBLE as CODES_MISSING_DOUBLE
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\__init__.py:13
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 13 from .gribapi import * # noqa
14 from .gribapi import __version__, lib
16 # The minimum recommended version for the ecCodes package
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\gribapi.py:34
30 from functools import wraps
32 import numpy as np
---> 34 from gribapi.errors import GribInternalError
36 from . import errors
37 from .bindings import ENC
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\errors.py:16
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
9 # does it submit to any jurisdiction.
10 #
12 """"""
13 Exception class hierarchy
14 """"""
---> 16 from .bindings import ENC, ffi, lib
19 class GribInternalError(Exception):
20 """"""
21 @brief Wrap errors coming from the C API in a Python exception object.
22
23 Base class for all exceptions
24 """"""
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\bindings.py:40
37 # default encoding for ecCodes strings
38 ENC = ""ascii""
---> 40 ffi = cffi.FFI()
41 CDEF = pkgutil.get_data(__name__, ""grib_api.h"")
42 CDEF += pkgutil.get_data(__name__, ""eccodes.h"")
File ~\Anaconda3\envs\doom_test\lib\site-packages\cffi\api.py:48, in FFI.__init__(self, backend)
42 """"""Create an FFI instance. The 'backend' argument is used to
43 select a non-default backend, mostly for tests.
44 """"""
45 if backend is None:
46 # You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with
47 # _cffi_backend.so compiled.
---> 48 import _cffi_backend as backend
49 from . import __version__
50 if backend.__version__ != __version__:
51 # bad version! Try to be as explicit as possible.
ModuleNotFoundError: No module named '_cffi_backend'
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1570587416,https://api.github.com/repos/pydata/xarray/issues/7884,1570587416,IC_kwDOAMm_X85dnUMY,14808389,2023-05-31T16:56:16Z,2023-05-31T16:58:23Z,MEMBER,"> No module named '_cffi_backend'
Does simply `import cfgrib` work for you? I suspect it doesn't, which would explain the issue. It's unfortunate that the error is rewritten to ""unknown engine"", but I'm not sure how we would detect that it's a dependency that fails.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1570518243,https://api.github.com/repos/pydata/xarray/issues/7884,1570518243,IC_kwDOAMm_X85dnDTj,48015835,2023-05-31T16:06:55Z,2023-05-31T16:06:55Z,NONE,"The version of `cfgrib` i have is: `cfgrib=0.9.10.4`
I tried to update my own environment as you advised and have this error:
```
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
File ~\Anaconda3\envs\doom_test\lib\site-packages\xarray\tutorial.py:151, in open_dataset(name, cache, cache_dir, engine, **kws)
150 try:
--> 151 import cfgrib # noqa
152 except ImportError as e:
File ~\Anaconda3\envs\doom_test\lib\site-packages\cfgrib\__init__.py:20
19 from .abc import Field, Fieldset, Index, MappingFieldset
---> 20 from .cfmessage import COMPUTED_KEYS
21 from .dataset import (
22 Dataset,
23 DatasetBuildError,
(...)
27 open_from_index,
28 )
File ~\Anaconda3\envs\doom_test\lib\site-packages\cfgrib\cfmessage.py:29
27 import numpy as np
---> 29 from . import abc, messages
31 LOG = logging.getLogger(__name__)
File ~\Anaconda3\envs\doom_test\lib\site-packages\cfgrib\messages.py:28
27 import attr
---> 28 import eccodes # type: ignore
29 import numpy as np
File ~\Anaconda3\envs\doom_test\lib\site-packages\eccodes\__init__.py:13
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 13 from .eccodes import * # noqa
14 from .highlevel import *
File ~\Anaconda3\envs\doom_test\lib\site-packages\eccodes\eccodes.py:12
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 12 from gribapi import (
13 CODES_PRODUCT_ANY,
14 CODES_PRODUCT_BUFR,
15 CODES_PRODUCT_GRIB,
16 CODES_PRODUCT_GTS,
17 CODES_PRODUCT_METAR,
18 )
19 from gribapi import GRIB_CHECK as CODES_CHECK
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\__init__.py:13
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 13 from .gribapi import * # noqa
14 from .gribapi import __version__, lib
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\gribapi.py:34
32 import numpy as np
---> 34 from gribapi.errors import GribInternalError
36 from . import errors
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\errors.py:16
12 """"""
13 Exception class hierarchy
14 """"""
---> 16 from .bindings import ENC, ffi, lib
19 class GribInternalError(Exception):
File ~\Anaconda3\envs\doom_test\lib\site-packages\gribapi\bindings.py:40
38 ENC = ""ascii""
---> 40 ffi = cffi.FFI()
41 CDEF = pkgutil.get_data(__name__, ""grib_api.h"")
File ~\Anaconda3\envs\doom_test\lib\site-packages\cffi\api.py:48, in FFI.__init__(self, backend)
45 if backend is None:
46 # You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with
47 # _cffi_backend.so compiled.
---> 48 import _cffi_backend as backend
49 from . import __version__
ModuleNotFoundError: No module named '_cffi_backend'
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
Cell In[30], line 2
1 import xarray as xr
----> 2 xr.tutorial.open_dataset(""era5-2mt-2019-03-uk.grib"")
File ~\Anaconda3\envs\doom_test\lib\site-packages\xarray\tutorial.py:153, in open_dataset(name, cache, cache_dir, engine, **kws)
151 import cfgrib # noqa
152 except ImportError as e:
--> 153 raise ImportError(
154 ""Reading this tutorial dataset requires the cfgrib package.""
155 ) from e
157 url = f""{base_url}/raw/{version}/{path.name}""
159 # retrieve the file
ImportError: Reading this tutorial dataset requires the cfgrib package.
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1569021273,https://api.github.com/repos/pydata/xarray/issues/7884,1569021273,IC_kwDOAMm_X85dhV1Z,14808389,2023-05-30T20:07:31Z,2023-05-30T20:08:04Z,MEMBER,"No, this should still work:
```sh
conda create -n test -c conda-forge xarray ipython python=3.11 cfgrib pooch
conda activate test
ipython
```
```python
import xarray as xr
xr.tutorial.open_dataset(""era5-2mt-2019-03-uk.grib"")
```
We somewhat recently dropped the builtin `cfgrib` engine in favor of the one provided by the `cfgrib` package (and that is also the reason why the example in the docs fails: `cfgrib` is not installed into the docs environment anymore, which is definitely an oversight).
Which version of `cfgrib` do you have? For reference, in the environment built with the command above I have `cfgrib=0.9.10.3`","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1568737270,https://api.github.com/repos/pydata/xarray/issues/7884,1568737270,IC_kwDOAMm_X85dgQf2,48015835,2023-05-30T16:32:00Z,2023-05-30T16:32:00Z,NONE,"Thanks for getting back to me!
cfgrib is installed. I believe it might be a case that grib files are no longer readable in this way that I am following from: https://docs.xarray.dev/en/stable/examples/ERA5-GRIB-example.html
As there are error messages on this example page.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1568726002,https://api.github.com/repos/pydata/xarray/issues/7884,1568726002,IC_kwDOAMm_X85dgNvy,14808389,2023-05-30T16:23:30Z,2023-05-30T16:23:30Z,MEMBER,"as stated by the exception, the `cfgrib` engine is unknown, which usually means you're missing the `cfgrib` package (or this is a environment issue). If you did indeed install it, can you post the output of either `conda list` or `pip list` (in case you're not using `conda`)?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720
https://github.com/pydata/xarray/issues/7884#issuecomment-1568648350,https://api.github.com/repos/pydata/xarray/issues/7884,1568648350,IC_kwDOAMm_X85df6ye,30606887,2023-05-30T15:32:08Z,2023-05-30T15:32:08Z,NONE,"Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the [Contributing Guide](https://docs.xarray.dev/en/latest/contributing.html) for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1732510720