6

I have installed ecCodes library with

pip install eccodes

When I check it with 'pip list' it seems like it is installed as 0.9.7 ver but command:

python -m eccodes selfcheck

Returns error

RuntimeError: Could not load the ecCodes library!

The same error occurs when I try to import eccodes. I am using Windows 10 and Python 3.7.6 Any thougths what is wrong?

Full error:

import eccodes
Traceback (most recent call last):

  File "<ipython-input-1-cfa7540a6bb2>", line 1, in <module>
    import eccodes

  File "C:\Users\admin1\anaconda3\lib\site-packages\eccodes\__init__.py", line 15, in <module>
    from .eccodes import *

  File "C:\Users\admin1\anaconda3\lib\site-packages\eccodes\eccodes.py", line 12, in <module>
    from gribapi import __version__

  File "C:\Users\admin1\anaconda3\lib\site-packages\gribapi\__init__.py", line 13, in <module>
    from .gribapi import *  # noqa

  File "C:\Users\admin1\anaconda3\lib\site-packages\gribapi\gribapi.py", line 2217, in <module>
    __version__ = grib_get_api_version()

  File "C:\Users\admin1\anaconda3\lib\site-packages\gribapi\gribapi.py", line 2207, in grib_get_api_version
    raise RuntimeError("Could not load the ecCodes library!")

RuntimeError: Could not load the ecCodes library!
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
Słowik
  • 153
  • 1
  • 2
  • 9
  • Is that the entire error output? A quick google search for that error message returns some relevant results, have you already consulted all of those? – AMC Apr 15 '20 at 21:18
  • 1
    I have edited post and added full error output. Nothing of the solutions on google was useful for me – Słowik Apr 15 '20 at 21:21
  • 1
    Did you ever resolve this issue by chance? I am getting the same error and cannot resolve. – cgage1 Dec 24 '20 at 17:27

3 Answers3

2

The python package eccodes is only a binding to the C library eccodes made by ECMWF.

https://confluence.ecmwf.int/display/ECC/ecCodes+installation

As you can read on this website, they do not support Windows.

Advise from me: you won't get happy reading grib files (and working with meteorological data in general) on Windows. You could consider using Ubuntu or another Linux distro, maybe also just on a VM.

2

There is a conda package eccodes for the C library:

conda install -c conda-forge eccodes

Alternately, you can install those outside of your conda environment, for example, by compiling from source.

Then there is a pypi package eccodes that contains only the Python bindings:

pip install eccodes

You need both! From your error message, it seems that you have the Python bindings, but not the underlying C library.

For more (slightly dated) information, see the ECMWF Confluence wiki:

https://confluence.ecmwf.int/display/UDOC/How+to+install+ecCodes+with+Python+bindings+in+conda+-+ecCodes+FAQ

gerrit
  • 24,025
  • 17
  • 97
  • 170
0

The 'ecmwflibs' library install will help.

pip install ecmwflibs

import ecmwflibs

import eccodes
eglease
  • 2,445
  • 11
  • 18
  • 28
  • Answer needs supporting information Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](https://stackoverflow.com/help/how-to-answer). – moken Jul 07 '23 at 13:38