-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Bug Description
Installing the faiss-cpu dependency fails when Python 3.12 is used with the following error:
pdm.termui: faiss/faiss/python/swigfaiss.i:622: Error: Unable to find 'faiss/impl/AuxIndexStructures.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:623: Error: Unable to find 'faiss/impl/IDSelector.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:625: Error: Unable to find 'faiss/IndexIDMap.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:632: Error: Unable to find 'faiss/utils/approx_topk/mode.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:897: Error: Unable to find 'faiss/index_io.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:898: Error: Unable to find 'faiss/clone_index.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:902: Error: Unable to find 'faiss/AutoTune.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:903: Error: Unable to find 'faiss/index_factory.h'
pdm.termui: faiss/faiss/python/swigfaiss.i:904: Error: Unable to find 'faiss/MatrixStats.h'
pdm.termui: error: command '/usr/bin/swig' failed with exit code 1
✖ Install faiss-cpu 1.9.0.post1 failed
See full logs at: install-tools-output.txt
I was able to start the service without that dependency but it would error out as below when the RAG was configured:
2025-01-07 14:02:20,762 [ols.src.auth.auth:auth.py:34] INFO: Authentication retrieval for module noop and virtual path /ols-access
2025-01-07 14:02:20,765 [ols.src.auth.auth:auth.py:34] INFO: Authentication retrieval for module noop and virtual path /ols-access
INFO: Started server process [810019]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
2025-01-07 14:02:23,810 [ols.src.rag_index.index_loader:index_loader.py:73] INFO: Setting up settings for index load...
LLM is explicitly disabled. Using MockLLM.
2025-01-07 14:02:24,090 [ols.src.rag_index.index_loader:index_loader.py:76] INFO: Setting up storage context for index load...
2025-01-07 14:02:24,091 [ols.src.rag_index.index_loader:index_loader.py:97] ERROR: Error loading vector index:
No module named 'faiss'
Traceback (most recent call last):
File "/home/lucas/ols/lightspeed-service/ols/src/rag_index/index_loader.py", line 89, in _load_index
self._set_context()
File "/home/lucas/ols/lightspeed-service/ols/src/rag_index/index_loader.py", line 79, in _set_context
vector_store=FaissVectorStore.from_persist_dir(self._index_path),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lucas/ols/lightspeed-service/.venv/lib/python3.12/site-packages/llama_index/vector_stores/faiss/base.py", line 94, in from_persist_dir
return cls.from_persist_path(persist_path=persist_path, fs=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lucas/ols/lightspeed-service/.venv/lib/python3.12/site-packages/llama_index/vector_stores/faiss/base.py", line 102, in from_persist_path
import faiss
ModuleNotFoundError: No module named 'faiss'
2025-01-07 14:02:24,092 [ols.src.rag_index.index_loader:index_loader.py:103] WARNING: Proceeding without RAG content. Either there is an error or required parameters are not
set.
Searching on the web I came across the following comment saying that the issue is due to Python 3.12: facebookresearch/faiss#1589 (comment)
I then reverted the following commit and it worked for me: 07d4391
My OS is RHEL 9.4.
Output of OLS
version
OLS Version: It was main branch latest commit 90e13d8
To Reproduce
On a RHEL 9.4 machine
- Clone the repository
git clone https://github.com/openshift/lightspeed-service
cd lightspeed-service
- Run "make install-tools"
After some time you should be able to see the error mid-installation
Expected behavior
Dependencies to be installed correctly
Additional information
As said in the bug description, reverting the commit 07d4391 will cause pdm to use the Python version 3.11 and everything worked for me after that.