error with cfgrib + eccodes

See original GitHub issue

Hi, I tried to install cfgrib and eccodes on two different conda installations. Installation is always successful. Right now I do have:

% conda list | egrep "(eccodes|cfgrib)"
cfgrib                    0.9.9.0            pyhd8ed1ab_0    conda-forge
eccodes                   2.21.0               ha0e6eb6_0    conda-forge
python-eccodes            2021.03.0        py38hb5d20a5_1    conda-forge

Importing xarray works, but whenever I do an “import cfgrib” or an “ds = xarray.open_dataset(‘gribfile.grb’, engine=‘cfgrib’)”, I get:

self.ds = cfgrib.open_file(filename, **backend_kwargs) AttributeError: partially initialized module 'cfgrib' has no attribute 'open_file' (most likely due to a circular import)

(full error output attached). This happens on both conda installations (one is miniforge3-4.9.2.3, the other one is anaconda3 conda version 4.10).

Any idea what can cause this issue? FYI: I just downgraded cfgrib to 0.9.8.5 and now it works.

Cheers, Olaf

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ocarinocommented, Apr 16, 2021

Hi,

keewis wrote on 15.04.21 17:51:

did you try |mamba| or |conda| from |miniconda|?

right now I only did miniforge (though our elder python environments are anaconda or conda). And: Yes, the env was activated and no other xarray or cfgrib stuff around here. 😃

When I create a complete new miniforge3-4.9.2-3 on our system and only do a

conda install eccodes conda install cfgrib

the thing works. So there must be some relicts from earlier package installs or some other versions that cause the trouble. I got some hints from a different site that it might even be dependent on the order in which things are installed, not sure about that. Still I wonder that the error message seems to imply that there might be a circular import…

I’ll do some further testing and will come back when I have something that is more concrete so that you can look at it.

Thanks, Olaf

– Dipl. Inform. Olaf Gellert email @.*** Deutsches Klimarechenzentrum GmbH phone +49 (0)40 460094 214 Bundesstrasse 45a fax +49 (0)40 460094 270 D-20146 Hamburg, Germany www http://www.dkrz.de

Sitz der Gesellschaft: Hamburg Geschäftsführer: Prof. Dr. Thomas Ludwig Registergericht: Amtsgericht Hamburg, HRB 39784

1reaction
keewiscommented, Apr 13, 2021

We would need more information about your environments. Could you post the output of xr.show_versions()? Also, can you reproduce this with

xr.tutorial.open_dataset("era5-2mt-2019-03-uk.grib", engine="cfgrib")
Read more comments on GitHub >

github_iconTop Results From Across the Web

ECCODES ERROR when opening .GRIB file in Spyder/Visual ...
I solved that problem just creating an environment variable called ECCODES_DEFINITION_PATH . You have to find the path to "definition" ...
Read more >
Unable to import cfgrib - Stack Overflow
Whenever I try importing cfgrib it gives me runtime error that it could not load ecCodes library import cfgrib.
Read more >
cfgrib - PyPI
Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes.
Read more >
cfgrib - Python Package Health Analysis - Snyk
Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes. For more information about how...
Read more >
ecCodes version 2.24.0 released - ECMWF Confluence Wiki
Please use cfgrib and pdbufr instead. ... differences in string arrays; [ECC-1274] - BUFR: duplicated/incorrect error messages during decode ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found