hnswlib
hnswlib copied to clipboard
Apple M1 support?
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?
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?
There is also https://github.com/nmslib/hnswlib/pull/299 (it slipped away fro m attention). Can you test if it is working?
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
@mkurovski Can you try with clang 13 and -mcpu=apple-m1
?
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.
This worked for me
ARCHFLAGS="-arch arm64" pip install hnswlib
Don't thank me.