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

Can't build with Python v3.13 #587

Open
endlisnis opened this issue Feb 8, 2025 · 3 comments
Open

Can't build with Python v3.13 #587

endlisnis opened this issue Feb 8, 2025 · 3 comments

Comments

@endlisnis
Copy link

endlisnis commented Feb 8, 2025

I'm trying to install this with Python3.13. After many iterations to get the prerequisites installed, I finally got to this compilation failure:

      Compiling src/ext/g2clib.pyx because it changed.
      [1/1] Cythonizing src/ext/g2clib.pyx
      building 'grib2io.g2clib' extension
      creating build/temp.linux-x86_64-cpython-313/src/ext
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -O3 -fPIC -I/usr/local/include -I/tmp/pip-build-env-tv0ft7wn/overlay/lib64/python3.13/site-packages/numpy/_core/include -I/usr/include/python3.13 -c src/ext/g2clib.c -o build/temp.linux-x86_64-cpython-313/src/ext/g2clib.o
      src/ext/g2clib.c: In function ‘__pyx_f_7grib2io_6g2clib__toarray’:
      src/ext/g2clib.c:3224:10: error: implicit declaration of function ‘PyObject_AsWriteBuffer’; did you mean ‘PyObject_GetBuffer’? [-Wimplicit-function-declaration]
       3224 |   (void)(PyObject_AsWriteBuffer(__pyx_v_a, (&__pyx_v_abuf), (&__pyx_v_buflen)));
            |          ^~~~~~~~~~~~~~~~~~~~~~
            |          PyObject_GetBuffer
      src/ext/g2clib.c: In function ‘__pyx_pf_7grib2io_6g2clib_10unpack7’:
      src/ext/g2clib.c:5601:10: error: implicit declaration of function ‘PyObject_AsReadBuffer’; did you mean ‘PyObject_GetBuffer’? [-Wimplicit-function-declaration]
       5601 |   (void)(PyObject_AsReadBuffer(__pyx_v_drtmpl, (&__pyx_v_drtmpldat), (&__pyx_v_buflen)));
            |          ^~~~~~~~~~~~~~~~~~~~~
            |          PyObject_GetBuffer
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for grib2io
Failed to build grib2io
ERROR: Failed to build installable wheels for some pyproject.toml based projects (grib2io)

I'm trying to install this inside a podman container running Fedora 41, which comes with Python3.13.

I asked GrokAI about this failure, and it says:

The error message you're encountering is due to an implicit declaration of the function PyObject_AsWriteBuffer, which has been deprecated and removed in newer versions of Python. Here's how you can address this issue:

Solution:

Replace PyObject_AsWriteBuffer with Py_buffer and PyObject_GetBuffer:
@endlisnis endlisnis changed the title Can't build with current Python version Can't build with Python v3.13 Feb 8, 2025
@john970
Copy link

john970 commented Feb 17, 2025

I'm running into the same issue, which is confusing as I believe those cython functions were removed in 3.10.

@EricEngle-NOAA
Copy link
Contributor

Hi @endlisnis and @john970 - this is more of a grib2io build issue. This is a known issue. Apologies that the grib2io README says 3.8+ -- I never updated to 3.8 - 3.12.

Anyways...I am actively working on this. See NOAA-MDL/grib2io#156 and https://github.com/NOAA-MDL/grib2io/tree/refactor-g2clib-cython

@EricEngle-NOAA
Copy link
Contributor

This issue can be closed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants