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

Building the fast CFFI API? #8

Open
marfel opened this issue Oct 4, 2019 · 2 comments
Open

Building the fast CFFI API? #8

marfel opened this issue Oct 4, 2019 · 2 comments
Assignees
Labels
documentation Something is not clear enough

Comments

@marfel
Copy link

marfel commented Oct 4, 2019

Hi,

sorry, are the instructions for building the faster API still valid? Because on the ECMWF website https://confluence.ecmwf.int/display/ECC/ecCodes+installation it says "The Python 3 bindings are now built with CFFI and are packaged separately"?

If the instructions are still true and could lead to a dramatic speedup, I would definitely like to have them. But I don't understand what you mean by "clone the repo in the same folder as your ecCodes source tree"? I tried cloning to

eccodes-2.13.1-Source/eccodes-python and
eccodes-2.13.1-Source/src/eccodes-python

but every time I get

gcc -pthread -B /home/martin/.conda/envs/py3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/martin/.conda/envs/py3/include/python3.6m -c gribapi/_bindings.c -o ./gribapi/_bindings.o
gribapi/_bindings.c:492:10: fatal error: eccodes.h: No such file or directory
 #include <eccodes.h>
          ^~~~~~~~~~~

Could you give me a hint, please?
Thanks a lot,
Martin

@alexamici alexamici self-assigned this Oct 4, 2019
@alexamici alexamici added the documentation Something is not clear enough label Oct 4, 2019
@alexamici
Copy link
Contributor

@marfel you are right the documentation is not clear, the clone must be in the same folder as eccodes-2.13.1-Source:

$ ls
eccodes-2.13.1-Source/
eccodes-python/

I'll reword the section to make it clearer.

@ejd
Copy link

ejd commented Jul 16, 2024

I took the following steps to try building the fast bindings but had no luck:

  1. download eccodes-2.36.0.tar.gz

  2. tar -xvf eccodes-2.36.0.tar.gz

  3. git clone https://github.com/ecmwf/eccodes-python.git (the resulting working copy is at e3a5940)

  4. python3.8 -m venv eccodes-python-venv

    At this point, the current directory looks like this:

    (eccodes-python-venv) ~/Documents/projects$ ls
    eccodes-2.36.0/
    eccodes-python/
    eccodes-python-venv/
    
  5. . eccodes-python-venv/bin/activate

  6. pip install "numpy<1.25" attrs cffi findlibs (per install_requires in setup.py)

  7. cd eccodes-python

  8. python builder.py

I get the same error as in #8 (comment) above. Here's the output from the invocation of python builder.py

generating ./gribapi/_bindings.c
(already up-to-date)
the current directory is '/home/ejd/Documents/projects/eccodes-python'
running build_ext
building 'gribapi._bindings' extension
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/ejd/Documents/projects/eccodes-python-venv/include -I/usr/include/python3.8 -c gribapi/_bindings.c -o ./gribapi/_bindings.o
gribapi/_bindings.c:569:10: fatal error: eccodes.h: No such file or directory
  569 | #include <eccodes.h>
      |          ^~~~~~~~~~~
compilation terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Something is not clear enough
Projects
None yet
Development

No branches or pull requests

3 participants