Cannot install Faiss in Google Collab

Has anyone gotten FAISS index to work in Google Collab (free version)?

I tried following the example mentioned in the doc.

However it throws an error at add_faiss_index() method saying you must install Faiss to use FaissIndex. This is despite the fact that I do

!pip install faiss-cpu
!pip install faiss-gpu
1 Like

You can find the solution to this issue in the Discord thread.

Were you able able to find a solution? I am encountering the same issue but in Snowflake. I have tried to follow the Discord threat but it seems it has been deleted.

I am getting the same problems. I do !pip install faiss-gpu and it gives me a message error. I ignore it and run the code and it actually works. Later I try to run again and it doesn’t and have this issue with faiss.

Trying to fix it but so far nothing

1 Like

I found the solution. The following code should fix it.

!apt install -y libomp-dev
!python -m pip install --upgrade faiss-gpu
1 Like