I'm trying to install the faiss-cpu package in my Python environment, but I'm encountering a build error related to swig.exe during the wheel building process. I'm working within a virtual environment on Windows and using Python 3.12.0.
Here's the error message I receive when I run pip install faiss-cpu:
error: subprocess-exited-with-error
× Building wheel for faiss-cpu (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [details of the error]
swig.exe -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWIN -module swigfaiss -o faiss\faiss\python\swigfaiss_wrap.cpp faiss\faiss\python\swigfaiss.i
error: command 'swig.exe' failed: None
Note: I have noticed a notification about a newer version of pip being available. Not sure if that's part of the issue.
To troubleshoot, I've attempted the following:
- Ensured that
swigis installed and the path toswig.exeis in my system's PATH environment variable. Runningswig -versionin the command prompt returns the version correctly. - I haven't yet updated pip and setuptools to the latest versions, but I noticed the notification about the new pip version (23.3.2).
- I have not checked if Visual C++ Build Tools are required and properly installed for this package.
I expected the package to install without any issues as I followed the standard pip installation procedure. I'm wondering if the issue is specific to my Python version (3.12.0) or some other configuration on my system.

In the current latest faiss-cpu package, 1.7.4, they specify up to python 3.11 -- it worked for me when downgraded to that version. https://pypi.org/project/faiss-cpu/1.7.4/