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

Running into Runtime error while trying to import eccodes #24

Open
eryk-slowinski opened this issue Apr 16, 2020 · 9 comments
Open

Running into Runtime error while trying to import eccodes #24

eryk-slowinski opened this issue Apr 16, 2020 · 9 comments

Comments

@eryk-slowinski
Copy link

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

@StephanSiemen
Copy link
Contributor

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.

@eryk-slowinski
Copy link
Author

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.

@StephanSiemen
Copy link
Contributor

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?

@eryk-slowinski
Copy link
Author

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.

@StephanSiemen
Copy link
Contributor

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".

@eryk-slowinski
Copy link
Author

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?

@StephanSiemen
Copy link
Contributor

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?

@eryk-slowinski
Copy link
Author

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?

@Bea07
Copy link

Bea07 commented Jun 14, 2024

i am having same problem but using venv.
I have them installed on the environment
cycler 0.11.0 debugpy 1.6.7 decorator 5.1.1 distlib 0.3.6 earthpy 0.9.4 eccodes 1.6.1 enpt-enmapboxapp 0.7.6 entrypoints 0.4
I run the code in jupyter notebook and works, but when I run it on .py is not working.
I am using xarray so i dont need to import eccodes directly, and I got same error:
lib\site-packages\xarray\backends\plugins.py:80: RuntimeWarning: Engine 'cfgrib' loading failed: Cannot find the ecCodes library warnings.warn(f"Engine {name!r} loading failed:\n{ex}", RuntimeWarning)
If I try to explicitly import eccodes , same error

Screenshot 2024-06-14 094043

I am using vs code, on windows 11

please help

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

3 participants