Giter Site home page Giter Site logo

Comments (13)

nfick avatar nfick commented on June 12, 2024 46

Changing versions didn't work for me. All I had to do was:
pip install ecmwflibs

From bindings.py in:

File "/home/panos/venv_eccodes/lib/python3.8/site-packages/gribapi/bindings.py", line 33, in <module>
    raise RuntimeError("Cannot find the ecCodes library")

There was:

try:
    import ecmwflibs as findlibs
except ImportError:
    import findlibs

The findlibs package was the problem.

from eccodes-python.

vipinkarthikeyan avatar vipinkarthikeyan commented on June 12, 2024 15

Before installing cfgrib,
$ pip install ecmwflibs
$ pip install eccodes==1.3.1
and then
$ pip install cfgrib

my ecmwflibs version is 0.4.3

Thanks to @CrayonAki

from eccodes-python.

epasseto avatar epasseto commented on June 12, 2024 13

What solved for me was REALLY to install ECMWFlibs, just because eccodes depends on this earlier library to work. The version of ECcodes does not matter!

So, at Google Colab, you can do:
!$ pip install ecmwflibs
!$ pip install eccodes
!$ pip install cfgrib

Found: eccodes v2.26.0
Your system is ready

from eccodes-python.

CrayonAki avatar CrayonAki commented on June 12, 2024 3

Ubuntu 20.04, python 3.8
Following @nfick, I installed ecmwflibs with pip install ecmwflibs.
I also tried to change version, but eccodes==1.2.0 seemed not working. So I tried version eccodes==1.3.1.
I don't know which step is actually working, but finally eccodes can be imported.

from eccodes-python.

Xunius avatar Xunius commented on June 12, 2024 1

Same here. pip install eccodes==1.2.0 worked for me.

from eccodes-python.

cccassidy avatar cccassidy commented on June 12, 2024 1

Tried some more tests and there appears to be some sort of conflict on RHEL-based systems: Amazon Linux 2 for example puts the libraries in a lib64/ directory (which fails) while Ubuntu does lib/ (which works).

As a workaround I renamed lib64 to lib and added the lib path to LD_LIBRARY_PATH and it worked under AL2. Not idea but maybe that helps track down the root cause?

from eccodes-python.

peterdudfield avatar peterdudfield commented on June 12, 2024 1

Im getting a similar error when runner a docker file

FROM python:3.9-slim

RUN apt-get -qq update \
    && apt-get -qq install -y --no-install-recommends \
        libproj-dev \
        libgeos-dev \
    && apt-get autoclean && apt-get autoremove \
    > /dev/null

# copy files
COPY metofficeamd/ app/metofficeamd/
COPY setup.py app/setup.py
COPY README.md app/README.md
COPY requirements.txt app/requirements.txt

# change to app folder
WORKDIR /app

# install library
RUN pip uninstall cfgrib
RUN pip install ecmwflibs
RUN pip install eccodes==1.3.1
RUN pip install cfgrib
RUN pip install -e .

# Example commnad that can be used, need to set API_KEY, API_SECRET and SAVE_DIR
CMD ["python", "metofficeamd/app.py"]

by adding 'libeccodes-tools' it now seems to work

from eccodes-python.

cccassidy avatar cccassidy commented on June 12, 2024

Can confirm what the above posters found as well, works with 1.2.0 but fails with anything 1.3.x
Using Python3.8 w/ ecCodes 2.22.0

from eccodes-python.

cccassidy avatar cccassidy commented on June 12, 2024

Hi @pmav99 @Xunius I just did a fresh install of ecCodes 2.22.1 and eccodes-python 1.3.3 on Ubuntu 20.04 and the import worked fine. I saw v1.3.3 was released since we noticed this error maybe it was fixed in that version?

from eccodes-python.

Balinus avatar Balinus commented on June 12, 2024

Tried some more tests and there appears to be some sort of conflict on RHEL-based systems: Amazon Linux 2 for example puts the libraries in a lib64/ directory (which fails) while Ubuntu does lib/ (which works).

As a workaround I renamed lib64 to lib and added the lib path to LD_LIBRARY_PATH and it worked under AL2. Not idea but maybe that helps track down the root cause?

Thanks! Updating the LD_LIBRARY_PATH is the only thing that worked for me (cluster on Cent OS)

from eccodes-python.

petebachant avatar petebachant commented on June 12, 2024

@nfick's fix works for me on Linux, but on Windows it causes some strange DLL load warnings:

C:\Users\peteb\miniconda3\envs\wedev\lib\site-packages\ecmwflibs\__init__.py:75:
 UserWarning: DLL load failed while importing _ecmwflibs: The specified procedur
e could not be found.
  warnings.warn(str(e))
C:\Users\peteb\miniconda3\envs\wedev\lib\site-packages\xarray\backends\cfgrib_.p
y:27: UserWarning: Failed to load cfgrib - most likely there is a problem access
ing the ecCodes library. Try `import cfgrib` to get the full error message
  warnings.warn(

But import eccodes works without error.

from eccodes-python.

peterdudfield avatar peterdudfield commented on June 12, 2024

Im getting a similar error when runner a docker file

FROM python:3.9-slim

RUN apt-get -qq update \
    && apt-get -qq install -y --no-install-recommends \
        libproj-dev \
        libgeos-dev \
    && apt-get autoclean && apt-get autoremove \
    > /dev/null

# copy files
COPY metofficeamd/ app/metofficeamd/
COPY setup.py app/setup.py
COPY README.md app/README.md
COPY requirements.txt app/requirements.txt

# change to app folder
WORKDIR /app

# install library
RUN pip uninstall cfgrib
RUN pip install ecmwflibs
RUN pip install eccodes==1.3.1
RUN pip install cfgrib
RUN pip install -e .

# Example commnad that can be used, need to set API_KEY, API_SECRET and SAVE_DIR
CMD ["python", "metofficeamd/app.py"]

from eccodes-python.

djhoese avatar djhoese commented on June 12, 2024

I'm working with someone who is trying to add cfgrib/eccodes to our build environment and is running into weird behavior. Sometimes they get the same error(s) mentioned here and other times the errors are slightly different and sometimes it works. Whether the environment works or errors out seems to be related to the order the packages are installed.

The order the packages are installed shouldn't matter, right? There should be no reason you can't do pip install ecmwflibs eccodes cfgrib since all the usage happens at runtime not install time...right?

Note: Some of the issues we're running into may be specific to us trying to use pyinstaller to bundle our environment into a distributed application.

from eccodes-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.