hynek / argon2-cffi-bindings

Low-level Python CFFI Bindings for Argon2
MIT License
8 stars 8 forks source link

Free-threaded builds fail #67

Open WhiteSymmetry opened 2 weeks ago

WhiteSymmetry commented 2 weeks ago

Successfully built jupyterlab Failed to build argon2-cffi-bindings ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (argon2-cffi-bindings)

OS: Ubuntu 24.10 (Oracular Oriole) gcc --version gcc (Ubuntu 14.2.0-4ubuntu2) 14.2.0 Miniconda Commands (mamba, conda, pip) pip install jupyterlab python -Im pip install --no-binary=argon2-cffi-bindings argon2-cffi-binding python -Im pip install argon2-cffi-bindings

python -m pip install argon2-cffi-bindings Collecting argon2-cffi-bindings Using cached argon2-cffi-bindings-21.2.0.tar.gz (1.8 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting cffi>=1.0.1 (from argon2-cffi-bindings) Using cached cffi-1.17.1-cp313-cp313t-linux_x86_64.whl Collecting pycparser (from cffi>=1.0.1->argon2-cffi-bindings) Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes) Using cached pycparser-2.22-py3-none-any.whl (117 kB) Building wheels for collected packages: argon2-cffi-bindings Building wheel for argon2-cffi-bindings (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for argon2-cffi-bindings (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [59 lines of output]

:488: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_cffi_backend', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0. running bdist_wheel running build running build_py creating build/lib.linux-x86_64-cpython-313t/_argon2_cffi_bindings copying src/_argon2_cffi_bindings/__init__.py -> build/lib.linux-x86_64-cpython-313t/_argon2_cffi_bindings copying src/_argon2_cffi_bindings/_ffi_build.py -> build/lib.linux-x86_64-cpython-313t/_argon2_cffi_bindings running build_ext generating cffi module 'build/temp.linux-x86_64-cpython-313t/_ffi.c' creating build/temp.linux-x86_64-cpython-313t building '_ffi' extension creating build/temp.linux-x86_64-cpython-313t/build/temp.linux-x86_64-cpython-313t creating build/temp.linux-x86_64-cpython-313t/extras/libargon2/src creating build/temp.linux-x86_64-cpython-313t/extras/libargon2/src/blake2 gcc -pthread -B /home/mk/miniconda3/envs/q13/shared/python_compiler_compat -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/mk/miniconda3/envs/q13/include -fPIC -O2 -isystem /home/mk/miniconda3/envs/q13/include -fPIC -Iextras/libargon2/include -I/home/mk/miniconda3/envs/q13/include/python3.13t -c build/temp.linux-x86_64-cpython-313t/_ffi.c -o build/temp.linux-x86_64-cpython-313t/build/temp.linux-x86_64-cpython-313t/_ffi.o -msse2 In file included from build/temp.linux-x86_64-cpython-313t/_ffi.c:57: /home/mk/miniconda3/envs/q13/include/python3.13t/Python.h:51:4: error: #error "The limited API is not currently supported in the free-threaded build" 51 | # error "The limited API is not currently supported in the free-threaded build" | ^~~~~ In file included from /home/mk/miniconda3/envs/q13/include/python3.13t/Python.h:68: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:213:5: error: unknown type name ‘PyMutex’ 213 | PyMutex ob_mutex; // per-object lock | ^~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h: In function ‘Py_REFCNT’: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:314:22: error: implicit declaration of function ‘_Py_atomic_load_uint32_relaxed’ [-Wimplicit-function-declaration] 314 | uint32_t local = _Py_atomic_load_uint32_relaxed(&ob->ob_ref_local); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:318:25: error: implicit declaration of function ‘_Py_atomic_load_ssize_relaxed’ [-Wimplicit-function-declaration] 318 | Py_ssize_t shared = _Py_atomic_load_ssize_relaxed(&ob->ob_ref_shared); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h: In function ‘_Py_IsImmortal’: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:352:63: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 352 | return (_Py_atomic_load_uint32_relaxed(&op->ob_ref_local) == | ^~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h: In function ‘Py_SET_REFCNT’: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:390:9: error: implicit declaration of function ‘_Py_IsOwnedByCurrentThread’ [-Wimplicit-function-declaration] 390 | if (_Py_IsOwnedByCurrentThread(ob)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h: In function ‘Py_SET_SIZE’: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:430:5: error: implicit declaration of function ‘_Py_atomic_store_ssize_relaxed’ [-Wimplicit-function-declaration] 430 | _Py_atomic_store_ssize_relaxed(&ob->ob_size, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h: In function ‘Py_INCREF’: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:811:9: error: implicit declaration of function ‘_Py_atomic_store_uint32_relaxed’ [-Wimplicit-function-declaration] 811 | _Py_atomic_store_uint32_relaxed(&op->ob_ref_local, new_local); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:814:9: error: implicit declaration of function ‘_Py_atomic_add_ssize’; did you mean ‘__atomic_add_fetch’? [-Wimplicit-function-declaration] 814 | _Py_atomic_add_ssize(&op->ob_ref_shared, (1 << _Py_REF_SHARED_SHIFT)); | ^~~~~~~~~~~~~~~~~~~~ | __atomic_add_fetch /home/mk/miniconda3/envs/q13/include/python3.13t/object.h: In function ‘Py_DECREF’: /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:907:13: error: implicit declaration of function ‘_Py_MergeZeroLocalRefcount’ [-Wimplicit-function-declaration] 907 | _Py_MergeZeroLocalRefcount(op); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/mk/miniconda3/envs/q13/include/python3.13t/object.h:911:9: error: implicit declaration of function ‘_Py_DecRefShared’; did you mean ‘_Py_DecRef’? [-Wimplicit-function-declaration] 911 | _Py_DecRefShared(op); | ^~~~~~~~~~~~~~~~ | _Py_DecRef 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 argon2-cffi-bindings Failed to build argon2-cffi-bindings ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (argon2-cffi-bindings)
hynek commented 2 weeks ago

What am I supposed to make of this? I don't know what you're trying to do, on what platform, using what commands. Your installer should be able to use argon2-cffi-bindings's wheels that work fine on all platforms that I have access to. Why it doesn't is not apparent from what you shared.

hynek commented 2 weeks ago

Thank you for the update – so it's Conda and you're attempting a free-threaded build?

It looks like those aren't supported by CFFI yet, so I don't think I can do anything about it for now: https://github.com/python-cffi/cffi/issues/126

WhiteSymmetry commented 2 weeks ago

pip install cffi Collecting cffi Using cached cffi-1.17.1-cp313-cp313t-linux_x86_64.whl Requirement already satisfied: pycparser in ./.local/lib/python3.13t/site-packages (from cffi) (2.22) Installing collected packages: cffi Successfully installed cffi-1.17.1

or

python3 -m pip install cffi Defaulting to user installation because normal site-packages is not writeable Collecting cffi Using cached cffi-1.17.1-cp313-cp313t-linux_x86_64.whl Collecting pycparser (from cffi) Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes) Using cached pycparser-2.22-py3-none-any.whl (117 kB) Installing collected packages: pycparser, cffi Successfully installed cffi-1.17.1 pycparser-2.22

WhiteSymmetry commented 1 week ago

linux-64/python-3.13.0rc2-h6355ac2_1_cp313t.conda In this version (Threading), it gives an installation error in this version.

linux-64/python-3.13.0rc2-h9ebbce0_101_cp313.conda There is no problem with this version.

They worked there when I copied the modules I installed here to the other side.

python -m pip install argon2-cffi-bindings Collecting argon2-cffi-bindings Downloading argon2_cffi_bindings-21.2.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.7 kB) Requirement already satisfied: cffi>=1.0.1 in ./miniconda3/envs/a13/lib/python3.13/site-packages (from argon2-cffi-bindings) (1.17.1) Requirement already satisfied: pycparser in ./.local/lib/python3.13/site-packages (from cffi>=1.0.1->argon2-cffi-bindings) (2.22) Downloading argon2_cffi_bindings-21.2.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (86 kB) Installing collected packages: argon2-cffi-bindings Successfully installed argon2-cffi-bindings-21.2.0

tacaswell commented 2 days ago

@minrk has a patch that builds:

https://github.com/hynek/argon2-cffi-bindings/compare/main...minrk:argon2-cffi-bindings:313t

I have been using this branch locally, but I'm not clear how I found it.

The downside is that with 313+jit that branch hangs in build.