local_llama icon indicating copy to clipboard operation
local_llama copied to clipboard

ERROR: Failed building wheel for faiss-cpu

Open plsnotracking opened this issue 2 years ago • 7 comments

Hello, trying to setup the project, running into issues.

Previous issues that seem related

Maybe this should be an issue for the upstream library itself.

Maybe these are related?

  • https://github.com/kyamagu/faiss-wheels/issues/87
  • https://github.com/kyamagu/faiss-wheels/issues/80

System Config

  • Running on a M2 Max machine.
  • 64GB RAM
  • MacOS Sonoma 14.4

Steps to repro the error

I have ollama running in a docker container and can be accessed at http://localhost:11434.

# copy the repo
git clone https://github.com/jlonge4/local_llama.git

# root dir
cd local_llama

# check python version
❯ python3 --version
Python 3.12.2

# create a python virtual env
python3 -m venv llama

# activate env
source llama/bin/activate

# fulfill requirements
python3 -m pip install -r requirements.txt

Failure

Error Stacktrace:

Using cached cryptography-42.0.5-cp39-abi3-macosx_10_12_universal2.whl (5.9 MB)
Using cached cffi-1.16.0-cp312-cp312-macosx_11_0_arm64.whl (177 kB)
Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: faiss-cpu
  Building wheel for faiss-cpu (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for faiss-cpu (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext
      building 'faiss._swigfaiss' extension
      swigging faiss/faiss/python/swigfaiss.i to faiss/faiss/python/swigfaiss_wrap.cpp
      swig -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i
      error: command 'swig' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for faiss-cpu
Failed to build faiss-cpu
ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects

Anything that I could do to fix it?

Thank you.

plsnotracking avatar Mar 13 '24 22:03 plsnotracking

@plsnotracking Ahhh I see. Perhaps you are onto something with the python version. I have been thinking of making this a docker container so maybe that would resolve it for everyone.

jlonge4 avatar Mar 16 '24 20:03 jlonge4

@jlonge4 anything I can do to help?

plsnotracking avatar Mar 26 '24 01:03 plsnotracking

I had the same issue. I created a clean-slate conda environment with python version 3.10 and in that environment the installation worked.

kkose avatar Apr 26 '24 21:04 kkose

@kkose @plsnotracking what do you two think about making this project use an in memory document store. Pros: none of these issues. Cons: your document index would only persist for the duration of your app session, and you'd have to reindex each time you ran it. Thoughts?

jlonge4 avatar Apr 26 '24 21:04 jlonge4

If it's not taxing enough on the system, I guess, having a long running job wouldn't hurt much tbh. Makes it at least usable.

plsnotracking avatar Jul 18 '24 19:07 plsnotracking

@plsnotracking Done! The latest version uses a persisted doc store

jlonge4 avatar Jul 18 '24 19:07 jlonge4

Let me take it for a spin over the weekend.

plsnotracking avatar Jul 23 '24 19:07 plsnotracking