joshlk / k-means-constrained

K-Means clustering - constrained with minimum and maximum cluster size. Documentation: https://joshlk.github.io/k-means-constrained
https://github.com/joshlk/k-means-constrained
BSD 3-Clause "New" or "Revised" License
192 stars 43 forks source link

[BUG] error compiling on apple silicon. #39

Closed JamiePringle closed 1 year ago

JamiePringle commented 1 year ago

When trying to pip install k-means-constrained on a apple silicon Mac running 12.6.2, I get the following error

      gcc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/pringle/opt/miniconda3/envs/parcels_Devel_mar2023/include -arch arm64 -fPIC -O2 -isystem /Users/pringle/opt/miniconda3/envs/parcels_Devel_mar2023/include -arch arm64 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/pringle/opt/miniconda3/envs/parcels_Devel_mar2023/include -D_FORTIFY_SOURCE=2 -isystem /Users/pringle/opt/miniconda3/envs/parcels_Devel_mar2023/include -I/private/var/folders/m7/lqt6wj8n3f5f9lzgf80t8l3m0000gn/T/pip-build-env-wt28n0t8/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/pringle/opt/miniconda3/envs/parcels_Devel_mar2023/include/python3.11 -c k_means_constrained/sklearn_import/cluster/_k_means.c -o build/temp.macosx-11.0-arm64-cpython-311/k_means_constrained/sklearn_import/cluster/_k_means.o
      clang: error: the clang compiler does not support '-march=core2'
      error: command '/usr/bin/gcc' failed with exit code 1

Happy to learn from others experiences before I dig into it myself...

Jamie Pringle

joshlk commented 1 year ago

Hi, I've just updated the build system and uploaded a new version to PyPI (v0.7.3) that includes a pre-compiled wheel for Apple Silicon. Can you try and see if it works:

pip install --upgrade k-means-constrained
joshlk commented 1 year ago

I assume this is fixed and so closing the issue. Please reopen if this issue persists or create a new issue.