Those instructions are working for me as of Nov. 2020. Using Homebrew and maOS 10.15.7
xcode-select --install
brew install llvm
Make sure /usr/local/opt/llvm/bin
is in your PATH
brew install openblas
brew install swig
git clone https://github.com/facebookresearch/faiss.git
CXX=/usr/local/opt/llvm/bin/clang++ CXXFLAGS="-fPIC -m64 -Wall -g -O3 -msse4 -mpopcnt -fopenmp -Wno-sign-compare -I/usr/local/opt/llvm/include -std=c++11 -I/usr/local/opt/openblas/include" LDFLAGS="-g -fPIC -fopenmp -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -L/usr/local/opt/openblas/lib" cmake -DFAISS_ENABLE_GPU=OFF -DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_libomp_LIBRARY=omp -DOpenMP_CXX_FLAGS="-fopenmp=libomp" -B build .
make -C build -j32
# build python
cd build/faiss/python && python setup.py install
make -C build test
Run:
python -c "import faiss, numpy
faiss.Kmeans(10, 20).train(numpy.random.rand(1000, 10).astype('float32'))"
Note: you have to unzip faiss egg file, create folder the same as egg name, move zip contents to the egg dir. See this