I am trying to install the cfgrib using pip using the following:
pip3 install --user eccodes
This installs the eccodes package along the following path:
/Library/name/Python/3.8/lib/python/site-packages
When I try to run my python script (see below) I get an error message telling me:
UserWarning: Failed to load cfgrib - most likely there is a problem accessing the ecCodes library. Try `import cfgrib` to get the full error message
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import cfgrib
path = '/Users/name/Library/Python/3.8/bin'
fname = 'download.grib'
ds = xr.open_dataset(path+fname,engine = 'cfgrib',backend_kwargs={'indexpath':''})
Does anyone know how to solve this?
Try
pip install ecmwflib
It worked for me.
Reference