Martinsos / edlib

Lightweight, super fast C/C++ (& Python) library for sequence alignment using edit (Levenshtein) distance.
http://martinsos.github.io/edlib
MIT License
492 stars 162 forks source link

Cannot install edlib for Python 3.11 on Windows #217

Open sverzakov opened 10 months ago

sverzakov commented 10 months ago

Describe the bug Edlib can be pip installed from PyPi for Python 3.10 on Windows, but the installation fails for Python 3.11

To Reproduce Make sure that MS Visual Studio is sitalled pip install edlib

Expected behavior Package is built and installed.

Environment (please complete the following information):

Additional context Failure message is:

(py3.11) PS D:\py3.11\Scripts> pip install edlib Looking in indexes: https://pypi.org/simple Collecting edlib Using cached edlib-1.3.9.tar.gz (91 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: edlib Building wheel for edlib (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for edlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [15 lines of output] running bdist_wheel running build running build_ext building 'edlib' extension creating build creating build\temp.win-amd64-cpython-311 creating build\temp.win-amd64-cpython-311\Release creating build\temp.win-amd64-cpython-311\Release\edlib creating build\temp.win-amd64-cpython-311\Release\edlib\src "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Iedlib/include -ID:\py3.11\include -ID:\Python-3.11\include -ID:\Python-3.11\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpedlib.bycython.cpp /Fobuild\temp.win-amd64-cpython-311\Release\edlib.bycython.obj -O3 -std=c++11 cl : Command line warning D9002 : ignoring unknown option '-O3' cl : Command line warning D9002 : ignoring unknown option '-std=c++11' edlib.bycython.cpp edlib.bycython.cpp(198): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory error: command 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for edlib Failed to build edlib ERROR: Could not build wheels for edlib, which is required to install pyproject.toml-based projects

sodiumnitrate commented 9 months ago

I'm getting the same error on macOS ventura with python 3.11. Installing from PyPI seems to be broken. Scroll down for a workaround.

The issue:

➜ pip install edlib

Collecting edlib
  Downloading edlib-1.3.9.tar.gz (91 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.4/91.4 kB 3.3 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: edlib
  Building wheel for edlib (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'edlib' extension
      creating build
      creating build/temp.macosx-12.5-x86_64-cpython-311
      creating build/temp.macosx-12.5-x86_64-cpython-311/edlib
      creating build/temp.macosx-12.5-x86_64-cpython-311/edlib/src
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Iedlib/include -I/Users/iremaltan/.pyenv/versions/3.11.2/include/python3.11 -c edlib.bycython.cpp -o build/temp.macosx-12.5-x86_64-cpython-311/edlib.bycython.o -O3 -std=c++11
      edlib.bycython.cpp:198: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 edlib
  Running setup.py clean for edlib
Failed to build edlib
ERROR: Could not build wheels for edlib, which is required to install pyproject.toml-based projects

Using apple clang version 14.0.3.

I also tried:

➜ git clone https://github.com/Martinsos/edlib.git
➜ cd edlib/bindings/python
➜ pip install .

It first failed because README.rst could not be found. I commented out the relevant section in setup.py and tried again:

Processing /Users/iremaltan/edlib/bindings/python
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: edlib
  Building wheel for edlib (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'edlib' extension
      creating build
      creating build/temp.macosx-12.5-x86_64-cpython-311
      creating build/temp.macosx-12.5-x86_64-cpython-311/edlib
      creating build/temp.macosx-12.5-x86_64-cpython-311/edlib/src
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Iedlib/include -I/Users/iremaltan/.pyenv/versions/3.11.2/include/python3.11 -c edlib.bycython.cpp -o build/temp.macosx-12.5-x86_64-cpython-311/edlib.bycython.o -O3 -std=c++11
      clang: error: no such file or directory: 'edlib.bycython.cpp'
      clang: error: no input files
      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 edlib
  Running setup.py clean for edlib
Failed to build edlib
ERROR: Could not build wheels for edlib, which is required to install pyproject.toml-based projects

I got it to work this way (in edlib/bindings/python):

➜  make
Collecting cogapp
  Downloading cogapp-3.3.0-py2.py3-none-any.whl (28 kB)
Installing collected packages: cogapp
Successfully installed cogapp-3.3.0
cog -d -o README.rst README-tmpl.rst
make: cog: No such file or directory
make: *** [README.rst] Error 1

➜ python -m cogapp -d -o README.rst README-tmpl.rst

and, after uncommenting the readme-related lines in setup.py:

➜ pip install .
Processing /Users/iremaltan/edlib/bindings/python
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: edlib
  Building wheel for edlib (setup.py) ... done
  Created wheel for edlib: filename=edlib-1.3.9-cp311-cp311-macosx_12_0_x86_64.whl size=71154 sha256=664e8b952a5bbd9e787262032d2d8e081dfbe2289bee24a33ce6cd6543cd4cda
  Stored in directory: /private/var/folders/y8/0nc0dd5x2tjgrzs6j5q790840000gn/T/pip-ephem-wheel-cache-wbloavga/wheels/53/6b/3f/b552203c99140794ae12add7c76f3f07696f3acc75b127f9b1
Successfully built edlib
Installing collected packages: edlib
Successfully installed edlib-1.3.9

➜  python
Python 3.11.2 (main, Mar  5 2023, 23:08:47) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import edlib
>>> edlib.align("elephant", "telephone")
{'editDistance': 3, 'alphabetLength': 8, 'locations': [(None, 8)], 'cigar': None}