When I try to run a precommit locally and I’m getting the following error log:
Failed to build python-Levenshtein-wheels
stderr:
error: subprocess-exited-with-error
× Building wheel for python-Levenshtein-wheels (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [214 lines of output]
/private/var/folders/44/jk1pxby9555ckx9vm9ygbl4c0000gq/T/pip-build-env-ahj64dqh/overlay/lib/python3.12/site-packages/setuptools/config/expand.py:133: SetuptoolsWarning: File '/private/var/folders/44/jk1pxby9555ckx9vm9ygbl4c0000gq/T/pip-install-mzfl5e3n/python-levenshtein-wheels_bc06a2aa41c84ef08ec27875130a3c05/CHANGELOG.rst' cannot be found
return 'n'.join(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-14.1-x86_64-cpython-312
creating build/lib.macosx-14.1-x86_64-cpython-312/Levenshtein
copying Levenshtein/StringMatcher.py -> build/lib.macosx-14.1-x86_64-cpython-312/Levenshtein
copying Levenshtein/__init__.py -> build/lib.macosx-14.1-x86_64-cpython-312/Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
creating build/temp.macosx-14.1-x86_64-cpython-312
creating build/temp.macosx-14.1-x86_64-cpython-312/Levenshtein
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -I/Users/ENV/.cache/pre-commit/repofltdlao5/py_env-python3.12/include -I/Users/eliasvolonakis/.pyenv/versions/3.12.0/include/python3.12 -c Levenshtein/_levenshtein.c -o build/temp.macosx-14.1-x86_64-cpython-312/Levenshtein/_levenshtein.o
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/ENV/.cache/pre-commit/repofltdlao5/py_env-python3.12/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c Levenshtein/_levenshtein.c -o build/temp.macosx-10.9-universal2-cpython-312/Levenshtein/_levenshtein.o
Levenshtein/_levenshtein.c:711:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:712:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:726:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:726:12: note: did you mean 'PyDict_GET_SIZE'?
/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/cpython/dictobject.h:53:26: note: 'PyDict_GET_SIZE' declared here
static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
^
Levenshtein/_levenshtein.c:729:15: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
string1 = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:729:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string1 = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:730:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string2 = PyUnicode_AS_UNICODE(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:796:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:797:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:805:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:812:15: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
string1 = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:812:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string1 = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:813:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string2 = PyUnicode_AS_UNICODE(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:840:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:841:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:848:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:850:15: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
string1 = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:850:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string1 = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:851:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string2 = PyUnicode_AS_UNICODE(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:890:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:891:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:900:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:902:15: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
string1 = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:902:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string1 = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:903:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string2 = PyUnicode_AS_UNICODE(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:992:43: warning: passing 'lev_byte *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
result = PyString_FromStringAndSize(medstr, len);
^~~~~~
/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/bytesobject.h:34:62: note: passing argument to parameter here
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
^
Levenshtein/_levenshtein.c:1001:16: error: call to undeclared function 'PyUnicode_FromUnicode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
result = PyUnicode_FromUnicode(medstr, len);
^
Levenshtein/_levenshtein.c:1001:14: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
result = PyUnicode_FromUnicode(medstr, len);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1071:15: warning: initializing 'lev_byte *' (aka 'unsigned char *') with an expression of type 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
lev_byte *s = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1077:43: warning: passing 'lev_byte *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
result = PyString_FromStringAndSize(medstr, len);
^~~~~~
/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/bytesobject.h:34:62: note: passing argument to parameter here
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
^
Levenshtein/_levenshtein.c:1082:21: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
Py_UNICODE *s = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:1082:17: warning: incompatible integer to pointer conversion initializing 'Py_UNICODE *' (aka 'int *') with an expression of type 'int' [-Wint-conversion]
Py_UNICODE *s = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1083:16: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
size_t l = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:1088:16: error: call to undeclared function 'PyUnicode_FromUnicode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
result = PyUnicode_FromUnicode(medstr, len);
^
Levenshtein/_levenshtein.c:1088:14: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
result = PyUnicode_FromUnicode(medstr, len);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1115:41: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
if (PySequence_Fast_GET_SIZE(wlist) != n) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
Levenshtein/_levenshtein.c:1201:16: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
strings[0] = PyString_AS_STRING(first);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1213:18: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
strings[i] = PyString_AS_STRING(item);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1237:18: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
strings[0] = PyUnicode_AS_UNICODE(first);
^
Levenshtein/_levenshtein.c:1237:16: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
strings[0] = PyUnicode_AS_UNICODE(first);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1238:16: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
sizes[0] = PyUnicode_GET_SIZE(first);
^
Levenshtein/_levenshtein.c:1249:18: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
strings[i] = PyUnicode_AS_UNICODE(item);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1378:15: warning: unused variable 's' [-Wunused-variable]
const char *s;
^
Levenshtein/_levenshtein.c:1379:13: warning: unused variable 'len' [-Wunused-variable]
size_t i, len;
^
Levenshtein/_levenshtein.c:1650:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1651:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1658:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:1660:15: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
string1 = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:1660:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string1 = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1661:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string2 = PyUnicode_AS_UNICODE(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1768:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1769:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1776:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
Levenshtein/_levenshtein.c:1778:15: error: call to undeclared function 'PyUnicode_AS_UNICODE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
string1 = PyUnicode_AS_UNICODE(arg1);
^
Levenshtein/_levenshtein.c:1778:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string1 = PyUnicode_AS_UNICODE(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1779:13: warning: incompatible integer to pointer conversion assigning to 'Py_UNICODE *' (aka 'int *') from 'int' [-Wint-conversion]
string2 = PyUnicode_AS_UNICODE(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1863:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string1 = PyString_AS_STRING(arg1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1864:13: warning: assigning to 'lev_byte *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
string2 = PyString_AS_STRING(arg2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
Levenshtein/_levenshtein.c:1878:43: warning: passing 'lev_byte *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
result = PyString_FromStringAndSize(s, len);
^
/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/bytesobject.h:34:62: note: passing argument to parameter here
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
^
Levenshtein/_levenshtein.c:1894:43: warning: passing 'lev_byte *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
result = PyString_FromStringAndSize(s, len);
^
/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/bytesobject.h:34:62: note: passing argument to parameter here
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
^
Levenshtein/_levenshtein.c:1913:12: error: call to undeclared function 'PyUnicode_GET_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
len1 = PyUnicode_GET_SIZE(arg1);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
41 warnings and 20 errors generated.
error: command '/usr/bin/clang' 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 python-Levenshtein-wheels
ERROR: Could not build wheels for python-Levenshtein-wheels, which is required to install pyproject.toml-based projects
Check the log at /Users/ENV/.cache/pre-commit/pre-commit.log
The precommit script is poetry run pre-commit run --all-files
. Python version is 3.12 and I’m running the precommit in Visual Studio Code. Going through the log, I’m not sure why the error "call to undeclared function ‘PyUnicode_GET_SIZE’;" is happening. That should be completed by python-levenshtein.
I suspect the error is due to this being in the pre-commit-config.yaml: https://github.com/Lucas-C/pre-commit-hooks. This is the only repo that refers to Levenshtein. All other repos do not seem to contain any mention of it.
Any assistance on resolving this error would be much appreciated!
2
Answers
Running
pre-commit autoupdate
resolved this. There was a versioning error, which was flagged by @Sébastien Vercammen.There are several concerns with your question:
Can you please clarify what your intention is?
If one of your pre-commit rules requires python-Levenshtein, try using levenshtein as package instead (same author same project, new name), as they seem to have prebuilt wheels published for py3.12. Alternatively, you’ll need to set up the build requirements for python-Levenshtein.