Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable march=native option when building on Apple M1 #363

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

yoshoku
Copy link
Contributor

@yoshoku yoshoku commented Jan 27, 2022

I failed to install hnswlib with pip on Apple M1. The output error message is as follows:

$ pip install hnswlib
Collecting hnswlib
  Using cached hnswlib-0.6.0.tar.gz (30 kB)

...

Building wheels for collected packages: hnswlib
  Building wheel for hnswlib (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:

...

  clang: error: the clang compiler does not support '-march=native'
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for hnswlib
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects
$

The cause of this error is that Apple M1's clang does not support the march=native option. I have fixed setup.py so that the march=native option is not given when building on Apple M1. With this fix, I have confirmed that the installation is successful:

$ pip install .
Processing /Users/yoshoku/hnswlib

...

Building wheels for collected packages: hnswlib
  Building wheel for hnswlib (pyproject.toml) ... done

...

Successfully built hnswlib
Installing collected packages: hnswlib
Successfully installed hnswlib-0.6.0
$

@yurymalkov yurymalkov changed the base branch from master to develop February 1, 2022 06:02
@yurymalkov
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants