editdistance icon indicating copy to clipboard operation
editdistance copied to clipboard

`editdistance` Wheel Fails To Build on Python 3.11

Open narolski opened this issue 2 years ago • 8 comments

editdistance==0.6.1 fails to build on Python 3.11:

  Command ['/Users/narolski/Library/Caches/pypoetry/virtualenvs/documentknowledge-DIbTc0Ty-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/Users/narolski/Library/Caches/pypoetry/virtualenvs/documentknowledge-DIbTc0Ty-py3.11', '--no-deps', '/Users/narolski/Library/Caches/pypoetry/artifacts/28/98/f6/7ed6f4eb639b58674ef44f7011c4dd5b5323046689653ef73f70250466/editdistance-0.6.1.tar.gz'] errored with the following return code 1, and output: 
  Processing /Users/narolski/Library/Caches/pypoetry/artifacts/28/98/f6/7ed6f4eb639b58674ef44f7011c4dd5b5323046689653ef73f70250466/editdistance-0.6.1.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Building wheels for collected packages: editdistance
    Building wheel for editdistance (pyproject.toml): started
    Building wheel for editdistance (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error
    
    × Building wheel for editdistance (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [135 lines of output]
        running bdist_wheel
        running build
        running build_py
        creating build
        creating build/lib.macosx-13-arm64-cpython-311
        creating build/lib.macosx-13-arm64-cpython-311/editdistance
        copying editdistance/__init__.py -> build/lib.macosx-13-arm64-cpython-311/editdistance
        copying editdistance/_editdistance.h -> build/lib.macosx-13-arm64-cpython-311/editdistance
        copying editdistance/def.h -> build/lib.macosx-13-arm64-cpython-311/editdistance
        running build_ext
        building 'editdistance.bycython' extension
        creating build/temp.macosx-13-arm64-cpython-311
        creating build/temp.macosx-13-arm64-cpython-311/editdistance
        clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I./editdistance -I/Users/narolski/Library/Caches/pypoetry/virtualenvs/documentknowledge-DIbTc0Ty-py3.11/include -I/Users/narolski/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c editdistance/_editdistance.cpp -o build/temp.macosx-13-arm64-cpython-311/editdistance/_editdistance.o
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:70:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
            for (int i = 0; i < size2 + 1; i++) d[0][i] = i;
                            ~ ^ ~~~~~~~~~
        editdistance/_editdistance.cpp:71:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
            for (int i = 1; i < size1 + 1; i++) {
                            ~ ^ ~~~~~~~~~
        editdistance/_editdistance.cpp:72:27: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                for (int j = 1; j < size2 + 1; j++) {
                                ~ ^ ~~~~~~~~~
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<1> >, varr<1> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:120:27: note: in instantiation of function template specialization 'edit_distance_map_<1UL>' requested here
            if(vsize == 1) return edit_distance_map_<1>(ap, *asizep, bp, *bsizep);
                                  ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<2> >, varr<2> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:121:32: note: in instantiation of function template specialization 'edit_distance_map_<2UL>' requested here
            else if(vsize == 2) return edit_distance_map_<2>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<3> >, varr<3> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:122:32: note: in instantiation of function template specialization 'edit_distance_map_<3UL>' requested here
            else if(vsize == 3) return edit_distance_map_<3>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<4> >, varr<4> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:123:32: note: in instantiation of function template specialization 'edit_distance_map_<4UL>' requested here
            else if(vsize == 4) return edit_distance_map_<4>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<5> >, varr<5> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:124:32: note: in instantiation of function template specialization 'edit_distance_map_<5UL>' requested here
            else if(vsize == 5) return edit_distance_map_<5>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<6> >, varr<6> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:125:32: note: in instantiation of function template specialization 'edit_distance_map_<6UL>' requested here
            else if(vsize == 6) return edit_distance_map_<6>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<7> >, varr<7> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:126:32: note: in instantiation of function template specialization 'edit_distance_map_<7UL>' requested here
            else if(vsize == 7) return edit_distance_map_<7>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<8> >, varr<8> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:127:32: note: in instantiation of function template specialization 'edit_distance_map_<8UL>' requested here
            else if(vsize == 8) return edit_distance_map_<8>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<9> >, varr<9> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:128:32: note: in instantiation of function template specialization 'edit_distance_map_<9UL>' requested here
            else if(vsize == 9) return edit_distance_map_<9>(ap, *asizep, bp, *bsizep);
                                       ^
        editdistance/_editdistance.cpp:44:26: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare]
                for(int r = 0; r <= tmax; ++r) {
                               ~ ^  ~~~~
        editdistance/_editdistance.cpp:98:12: note: in instantiation of function template specialization 'edit_distance_bpv<std::map<long long, varr<10> >, varr<10> >' requested here
            return edit_distance_bpv<cmap_v, typename cmap_v::mapped_type>(cmap, b, bsize, tmax, tlen);
                   ^
        editdistance/_editdistance.cpp:129:33: note: in instantiation of function template specialization 'edit_distance_map_<10UL>' requested here
            else if(vsize == 10) return edit_distance_map_<10>(ap, *asizep, bp, *bsizep);
                                        ^
        editdistance/_editdistance.cpp:70:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
            for (int i = 0; i < size2 + 1; i++) d[0][i] = i;
                            ~ ^ ~~~~~~~~~
        editdistance/_editdistance.cpp:130:12: note: in instantiation of function template specialization 'edit_distance_dp<long long>' requested here
            return edit_distance_dp<int64_t>(ap, *asizep, bp, *bsizep);  // dynamic programmingに任せる
                   ^
        editdistance/_editdistance.cpp:71:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
            for (int i = 1; i < size1 + 1; i++) {
                            ~ ^ ~~~~~~~~~
        editdistance/_editdistance.cpp:72:27: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                for (int j = 1; j < size2 + 1; j++) {
                                ~ ^ ~~~~~~~~~
        17 warnings generated.
        clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I./editdistance -I/Users/narolski/Library/Caches/pypoetry/virtualenvs/documentknowledge-DIbTc0Ty-py3.11/include -I/Users/narolski/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c editdistance/bycython.cpp -o build/temp.macosx-13-arm64-cpython-311/editdistance/bycython.o
        editdistance/bycython.cpp:216:12: fatal error: 'longintrepr.h' file not found
          #include "longintrepr.h"
                   ^~~~~~~~~~~~~~~
        1 error 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 editdistance
  Failed to build editdistance

This issue has been noted to occur for other libraries, as well: https://github.com/aio-libs/aiohttp/issues/6600.

narolski avatar Nov 10 '22 08:11 narolski

#91 will fix that if it gets merged

Joshix-1 avatar Nov 11 '22 17:11 Joshix-1

Looks like #91 was merged, any updates on a release which includes it?

trenslow avatar Nov 30 '22 11:11 trenslow

Are there any updates? :)

sscherfke avatar Jan 25 '23 17:01 sscherfke

Plz try 0.6.2 !

roy-ht avatar Jan 26 '23 04:01 roy-ht

I did and I get a ValueError: 'editdistance/bycython.pyx' doesn't match any files and that file is indeed not included in the sdist.

sscherfke avatar Jan 26 '23 10:01 sscherfke

The PyPI archive does not contain editdistance/bycython.pyx. One can instead build from the Github release:

pip install git+https://github.com/roy-ht/[email protected]

ccoulombe avatar Feb 10 '23 20:02 ccoulombe

Same issue when trying to install epitrans or editdistance separate. pip install git+https://github.com/roy-ht/[email protected] does not fix.

https://github.com/roy-ht/editdistance/releases/tag/v0.6.2

downloading zip from there and installing locally seems to fix.

Aphexus avatar Dec 14 '23 02:12 Aphexus

The PyPI archive does not contain editdistance/bycython.pyx. One can instead build from the Github release:

pip install git+https://github.com/roy-ht/[email protected]

This is a good temporary workaround, but pypi won't let you publish with this as a dependency. hopefully the fix gets published to pypi soon

roedoejet avatar Jan 30 '24 19:01 roedoejet