# Facebook FAISS on Databricks

**URL:** <https://discuss.huggingface.co/t/facebook-faiss-on-databricks/84701>\
**Category:** Intermediate\
**Created:** [May 1, 2024, 4:31pm UTC](https://discuss.huggingface.co/t/facebook-faiss-on-databricks/84701 "2024-05-01T16:31:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheDonovan](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/thedonovan/32/26460_2.png) [@TheDonovan](https://discuss.huggingface.co/u/TheDonovan)\
**Post date:** [May 1, 2024, 4:31pm UTC](https://discuss.huggingface.co/t/facebook-faiss-on-databricks/84701/1 "2024-05-01T16:31:51Z")

</div>

Been exploring this FAISS example on databricks, but I simply cannot get beyond indexing.

> **[Semantic search with FAISS - Hugging Face NLP Course](https://huggingface.co/learn/nlp-course/chapter5/6?fw=tf)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

embeddings\_dataset.add\_faiss\_index(column=“embeddings”)

leads to the following error.

ImportError: You must install Faiss to use FaissIndex. To do so you can run `conda install -c pytorch faiss-cpu` or `conda install -c pytorch faiss-gpu`. A community supported package is also available on pypi: `pip install faiss-cpu` or `pip install faiss-gpu`. Note that pip may not have the latest version of FAISS, and thus, some of the latest features and bug fixes may not be available.

No matter how I do it, I cannot manage to get FAISS working.

---

<div class="post-metadata">

**Author:** ![marcoespinoza](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/marcoespinoza/32/39666_2.png) [@marcoespinoza](https://discuss.huggingface.co/u/marcoespinoza)\
**Post date:** [January 23, 2025, 5:43pm UTC](https://discuss.huggingface.co/t/facebook-faiss-on-databricks/84701/2 "2025-01-23T17:43:36Z")

</div>

Were you able to find the solution? I am encountering the same issue in Snowflake.

---

<div class="post-metadata">

**Author:** ![lutailai](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lutailai/32/50746_2.png) [@lutailai](https://discuss.huggingface.co/u/lutailai)\
**Post date:** [July 8, 2025, 6:23am UTC](https://discuss.huggingface.co/t/facebook-faiss-on-databricks/84701/3 "2025-07-08T06:23:43Z")

</div>

I (finally) got FAISS to work – at least for Chapter 5 of the LLM Course on [Semantic search with FAISS](https://huggingface.co/learn/llm-course/en/chapter5/6?fw=pt). Crucially, I ran the embeddings\_dataset.add\_faiss\_index(column=“embeddings”) cell, completed the Semantic search tutorial successfully and got the right answer. 💯

I tried everything I could find online, including Gemini (who gave up), but the solution that worked for me was from the Github [README.md file](https://github.com/onfido/faiss_prebuilt/blob/master/README.md) for faiss\_prebuilt. Here is the code:

!apt install libopenblas-base libomp-dev  
!pip install faiss-cpu

I am running Python 3.11.13 in Colab, and I had to run this code to get datasets to work:

pip install -U datasets

The other methods I tried that failed were:

1. !apt install -y libomp-dev  
!python -m pip install --upgrade faiss-gpu
2. !pip install faiss-gpu-cu11==1.10.0
3. !pip install faiss-cpu
4. !pip install faiss-gpu
5. !pip install faiss-cpu=1.7.4 mkl=2021 blas=1.0=mkl
6. !wget [https://anaconda.org/pytorch/faiss-cpu/1.2.1/download/linux-64/faiss-cpu-1.2.1-py36\_cuda9.0.176\_1.tar.bz2](https://anaconda.org/pytorch/faiss-cpu/1.2.1/download/linux-64/faiss-cpu-1.2.1-py36_cuda9.0.176_1.tar.bz2)  
!tar xvjf faiss-cpu-1.2.1-py36\_cuda9.0.176\_1.tar.bz2  
!cp -r lib/python3.6/site-packages/\* /usr/local/lib/python3.6/dist-packages/  
!pip install mkl

but NONE worked for me. I considered downgrading Python to 3.7 because the [pypi.org](http://pypi.org) FAISS project lists it as a programming language, but since I got it to work, I don’t have to! 🥳
