ecmwf / eccodes-python

Python interface to the ecCodes GRIB/BUFR decoder/encoder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running into Runtime error while trying to import eccodes

eryk-slowinski opened this issue · comments

Hi I am trying to import eccodes in my python code and I run into error :

    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!

Command
python -m cfgrib selfcheck
returns

Found: ecCodes v2.17.0.
Your system is ready.

I am using Windows 10 and latest relase of conda and python

The conda package 'eccodes' at the moment only includes the library itself; not its Python interface. This is sufficient to make dependencies, such as cfgrib, Magics and Metview work. To use the low-level Python API you need to install it with "pip install eccodes". Very soon the Python interface should be part of the conda install.

conda install eccodes
Doesn't work for me at all. I installed eccodes via pip, as you propsed.
python -m eccodes selfcheck
returns the same error: RuntimeError: Could not load the ecCodes library!
However
python -m cfgrib selfcheck
returns

Found: ecCodes v2.17.0.
Your system is ready.

Sorry, took me a while to get a Windows machine to test. For me eccodes and cfgrib work. You say "conda install eccodes - Doesn't work for me at all." What does not work? Do you get an error when you run the install command?

conda install eccodes

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - eccodes

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

As with 'cfgrib' (ecmwf/cfgrib#136) 'eccodes' is only available from the conda-forge repo. As described on https://github.com/ecmwf/eccodes-python, you can install eccodes with "conda install -c conda-forge eccodes".

With "conda install -c conda-forge eccodes" I have a very big error (like 1000+ lines) so I will paste only this:

Package anaconda-project conflicts for:
anaconda-navigator -> anaconda-project[version='>=0.4']
anaconda==2020.02 -> anaconda-project==0.8.4=py_0The following specifications were found to be incompatible with your CUDA driver:

  - feature:/win-64::__cuda==10.1=0
  - feature:|@/win-64::__cuda==10.1=0

Your installed CUDA driver is: 10.1

So this means I need other version of CUDA driver and anaconda?

I tried various versions and combinations of packages under Windows but I am not able to reproduce your error. A bit googling showed me that others (unrelated to eccodes) have challenges with conda and cuda. Could you try an conda environment without cuda?

It seems like it has conflict with everything:

Package scikit-learn conflicts for:
anaconda==2020.02 -> scikit-learn==0.22.1[build='py37h6288b17_0|py36h6288b17_0|py38h6288b17_0']
nltk -> scikit-learn

Package pyepsg conflicts for:
iris -> cartopy[version='>=0.14'] -> pyepsg
cartopy -> pyepsg

Package liblief conflicts for:
py-lief -> liblief==0.9.0[build='ha925a31_3|ha925a31_2|ha925a31_0']
anaconda==2020.02 -> liblief==0.9.0=ha925a31_2
conda-build -> py-lief -> liblief==0.9.0[build='ha925a31_3|ha925a31_2|ha925a31_0']

Package brotlipy conflicts for:
requests -> urllib3[version='>=1.21.1,<1.26,!=1.25.0,!=1.25.1'] -> brotlipy[version='>=0.6.0']
urllib3 -> brotlipy[version='>=0.6.0']

Package owslib conflicts for:
iris -> cartopy[version='>=0.14'] -> owslib
cartopy -> owslib

Package pathtools conflicts for:
anaconda==2020.02 -> pathtools==0.1.2=py_1
anaconda==2020.02 -> watchdog==0.10.2=py36_0 -> pathtools[version='>=0.1.1']
spyder -> watchdog -> pathtools[version='>=0.1.1']
watchdog -> pathtools[version='>=0.1.1']

Package gmpy2 conflicts for:
sympy -> mpmath[version='>=0.19'] -> gmpy2
mpmath -> gmpy2

List like above is very long (over 6000 lines).
You think total reinstalling whole conda environment can help?