WojciechMula / pyahocorasick

Python module (C extension and plain python) implementing Aho-Corasick algorithm
BSD 3-Clause "New" or "Revised" License
952 stars 125 forks source link

Also build +test universal wheels on macOS ARM M1 chips #162

Open pombredanne opened 2 years ago

pombredanne commented 2 years ago

Since ARM is Apple's new default, it would make sense to ensure things work on ARM M1 chips

rnjudge commented 1 year ago

+1... I'm having trouble installing pyahocorasick on my Fusion Ubuntu machine running on Mac M1 ARM sillicon. This is a blocker to installing scancode @pombredanne.

  Running setup.py install for pyahocorasick ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyahocorasick did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      running install
      /home/rose/testenv/lib/python3.10/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 'ahocorasick' extension
      creating build
      creating build/temp.linux-aarch64-3.10
      aarch64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DAHOCORASICK_UNICODE= -I/home/rose/testenv/include -I/usr/include/python3.10 -c pyahocorasick.c -o build/temp.linux-aarch64-3.10/pyahocorasick.o
      error: command 'aarch64-linux-gnu-gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyahocorasick

note: This is an issue with the package mentioned above, not pip.
pombredanne commented 1 year ago

@rnjudge I want to make this work: do you know if there is a free CI where I could run or test a macOS ARM builds? @heliocastro you are suffering too.

What could we do? Is there something to do to help? a Ci using QEMU? or someone sponsoring the expenses to run a macOS ARM CI?

pombredanne commented 1 year ago

NB: the latest 2.0.0 will have a universal build for macOS..... the wheels may run on your machine. Fingers crossed.

pombredanne commented 1 year ago

https://pypi.org/project/pyahocorasick/2.0.0/ is out ... @rnjudge @heliocastro do you mind testing this with this: note that this WILL NOT run out of the box on ARM Linux, but it should run natively on macOS ARM. Start with a clean ARM shell (not under rosetta):

mkdir venv 
wget -O venv/virtualenv.pyz https://bootstrap.pypa.io/virtualenv/virtualenv.pyz
python3 venv/virtualenv.pyz --never-download --seeder pip  \
  --pip embed --setuptools embed --wheel embed \
  --no-vcs-ignore --no-periodic-update ./venv
source venv/bin/activate
pip install pyahocorasick==2.0.0 pytest
git clone https://github.com/WojciechMula/pyahocorasick
cd pyahocorasick
pytest -vvs 

Thanks!