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

Apple M1 support? #329

Open
stayrea1 opened this issue Jul 22, 2021 · 6 comments
Open

Apple M1 support? #329

stayrea1 opened this issue Jul 22, 2021 · 6 comments

Comments

@stayrea1
Copy link

I found that two packages having hsnw : faiss & hnswlib can not be installed in apple m1 silicon, so any solutions ? When will you support install on m1 silicon?

@yurymalkov
Copy link
Member

Hi @stayrea1, I do not have access to M1, though, my understanding is that there should be no obstacles for it to work.
I wonder, what is the error that you are getting?

@yurymalkov
Copy link
Member

There is also #299 (it slipped away fro m attention).
Can you test if it is working?

@mkurovski
Copy link

Unfortunately, this still does not seem to work on M1 or am I doing anything wrong here:
pip install hnswlib basically leads to the following error here (pip 21.3.1, Apple clang version 12.0.5 (clang-1205.0.22.9))

  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

@yurymalkov
Copy link
Member

@mkurovski Can you try with clang 13 and -mcpu=apple-m1?

@Jeadie
Copy link

Jeadie commented Feb 9, 2023

M1 user here. I didn't use #299, but I applied the following change to the CMakeLists.txt:11 (as described in #299):

11 11     if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
.. 12       if (APPLE)
.. 13            SET( CMAKE_CXX_FLAGS  "-Ofast -DNDEBUG -std=c++11 -DHAVE_CXX0X -fpic -ftree-vectorize")
.. 14       else()
12 15          SET( CMAKE_CXX_FLAGS  "-Ofast -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -ftree-vectorize")
.. 16       endif()

And was able to get python bindings to work. That is, I ran:

pip install hnswlib

And ran the python example from the README.

@sparfenyuk
Copy link

This worked for me

ARCHFLAGS="-arch arm64" pip install hnswlib

Don't thank me.

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

No branches or pull requests

5 participants