contrailcirrus/pycontrails

RuntimeWarning: Engine 'cfgrib' loading failed

Closed this issue · 3 comments

Description
Performing the installation python -m pip install "pycontrails[complete]" and running the example "Run CoCiP over a flight" (https://py.contrails.org/notebooks/run-cocip-on-flight.html) results in the following runtime warning:

RuntimeWarning: Engine 'cfgrib' loading failed: Cannot find the ecCodes library warnings.warn(f"Engine {name!r} loading failed:\n{ex}", RuntimeWarning)

Details

  • Version: pycontrails 0.51.0
  • Module: N/A
  • OS: Windows

Steps to Reproduce

  1. Create an anaconda environment: conda create --name pycontrails
  2. Activate the anaconda environment: conda activate pycontrails
  3. Install Python 3.9 to the environment: conda install python==3.9
  4. Install pycontrails using pip: python -m pip install "pycontrails[complete]"
  5. Run the example from the following link: https://py.contrails.org/notebooks/run-cocip-on-flight.html

Additional Notes
I have been able to eliminate this warning by running python -m pip install ecmwflibs. This solution was obtained here, but does not seem to be universal: ecmwf/eccodes-python#54 (comment)

Have you tested your eccodes installation with python -m eccodes selfcheck? If not, then I'd start with that to confirm that your environment can find the eccodes libraries. If you don't have them installed, you can install them using conda: see https://pypi.org/project/eccodes/.

All of that said, I've seen that warning before and it hasn't stopped me from running CoCiP. Unless you're having other issues that you think are connected to this warning you're probably safe to ignore it.

Thanks for your insight and quick response @thabbott. I did perform the test for my eccodes installation. The check could not find eccodes before running python -m pip install ecmwflibs, but did find it after running the command.

I was just worried the CoCiP results could be affected, but it doesn't seem to be the case. I leave it up to you whether you want to close this issue or leave it open.

@Calebsakhtar I took a closer look at this issue. Unfortunately ecmwflibs is a bit outdated and doesn't exist for Python 3.12.

I'm going to close this issue with the resolution that installing ecmwflibs on older versions of Python can help solve eecodes install issues.