Closed adampauls closed 2 months ago
The supported way of installing faiss is via conda. Have you tried using that (https://anaconda.org/pytorch/faiss-cpu) and see if that still produces on Mac M2?
I tried installing with conda, and it does work. Unfortunately, using conda is not an option for us. Do you have any idea what changed between 1.7.4 and 1.8.0.post1 to break the pypi/pip installation? I thought perhaps brew install libomp
would fix the issue, but it didn't.
I think I know what's going on: faiss
distributes a libomp.dylib
, but so does torch
. If I set the env variable KMP_DUPLICATE_LIB_OK=TRUE
, then the crash goes away. Is it possible that before 1.8.0, libomp was not distributed in the pypi whl and so this all worked okay?
I'll note that I did not try installing both torch and faiss-cpu in the same conda env. It's possible that that is broken as well.
We actually do not maintain pypi distribution so I'm not clear what changed, but it looks like there is a workaround for this issue for now
Summary
Something as simple as this:
gives
So does
Possibly related: https://github.com/facebookresearch/faiss/issues/2167.
1.7.4 worked fine. We only tried to upgrade to 1.8.0.post1 to get Python 3.12 support.
Platform
Macbook Pro M2 Max (2023).
faiss
installed using poetry from pypi.OS:
Faiss version: 1.8.0.post1
Installed from: pypi (using poetry). Tested on both python 3.11 and 3.12.
Running on:
Interface:
Reproduction instructions
See above snippet.