Martinsos / edlib

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

Wheels for macos python 3.11 #212

Open hredestig opened 1 year ago

hredestig commented 1 year ago

Hi,

Would you care to make wheels for macosx and python 3.11 please? When installing from source I sadly get

  error: subprocess-exited-with-error

  × Running setup.py install for edlib did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      /Users/henning/.virtualenvs/benchling11d/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'edlib' extension
      creating build
      creating build/temp.macosx-12-x86_64-cpython-311
      creating build/temp.macosx-12-x86_64-cpython-311/edlib
      creating build/temp.macosx-12-x86_64-cpython-311/edlib/src
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -Iedlib/include -I/Users/henning/.virtualenvs/benchling11d/include -I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c edlib.bycython.cpp -o build/temp.macosx-12-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]
ajhetherington commented 2 months ago

This is quite a bit later but I hope this can help anyone else coming across this, I was able to work around as follows. This is on python3.12, but should be similar for other versions:

❯ python3.12 -m venv venv12
source venv%                                                                                                                                       
❯ source venv12/bin/activate
❯ pip install --no-cache-dir cython setuptools wheel
Collecting cython
  Downloading Cython-3.0.10-py2.py3-none-any.whl.metadata (3.2 kB)
Collecting setuptools
  Downloading setuptools-69.2.0-py3-none-any.whl.metadata (6.3 kB)
Collecting wheel
  Downloading wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
Downloading Cython-3.0.10-py2.py3-none-any.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 4.4 MB/s eta 0:00:00
Downloading setuptools-69.2.0-py3-none-any.whl (821 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 821.5/821.5 kB 4.7 MB/s eta 0:00:00
Downloading wheel-0.43.0-py3-none-any.whl (65 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.8/65.8 kB 4.2 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools, cython
Successfully installed cython-3.0.10 setuptools-69.2.0 wheel-0.43.0

[notice] A new release of pip is available: 23.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip

Note that --no-cache-dir is required so that cython can be imported (see https://github.com/Martinsos/edlib/blob/master/bindings/python/setup.py)

❯ EDLIB_USE_CYTHON=1 pip install --no-cache-dir edlib
Collecting edlib
  Downloading edlib-1.3.9.tar.gz (91 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.4/91.4 kB 2.7 MB/s eta 0:00:00
  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-cp312-cp312-macosx_14_0_arm64.whl size=65999 sha256=65ab2d018008666195662e09865ec06702ed5bb9870284259375edd78e20bf0a
  Stored in directory: /private/var/folders/f5/z80qgkk14wggp90g64zb60840000gn/T/pip-ephem-wheel-cache-fmjmzex0/wheels/79/8f/1f/3af9518754b7327229d01c80162e887a7adf171b5c0dc74bcc
Successfully built edlib
Installing collected packages: edlib
Successfully installed edlib-1.3.9

[notice] A new release of pip is available: 23.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
❯ python
Python 3.12.1 (main, Dec  7 2023, 20:45:44) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import edlib
>>> edlib.align("telephone", "elephant")
{'editDistance': 3, 'alphabetLength': 8, 'locations': [(None, 7)], 'cigar': None}