Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre alpha] ERROR: Failed building wheel for faiss-cpu #2318

Closed
msmygit opened this issue Jun 24, 2024 · 5 comments
Closed

[pre alpha] ERROR: Failed building wheel for faiss-cpu #2318

msmygit opened this issue Jun 24, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@msmygit
Copy link
Contributor

msmygit commented Jun 24, 2024

Describe the bug
an error causing install failures. See below for details,

Browser and Version

  • Browser [e.g. chrome, safari]- n/a
  • Version [e.g. 22]- n/a
  • Python Version of the virtual environment is,
% python -V
Python 3.10.14

To Reproduce
Steps to reproduce the behavior:

  • Run python -m pip install langflow --pre --force-reinstall -U, and errors as below:
...
Collecting grpcio-status<2.0.dev0,>=1.33.2
  Using cached grpcio_status-1.64.1-py3-none-any.whl (14 kB)
  Using cached grpcio_status-1.64.0-py3-none-any.whl (14 kB)
  Using cached grpcio_status-1.64.0rc1-py3-none-any.whl (14 kB)
  Using cached grpcio_status-1.63.0-py3-none-any.whl (14 kB)
  Using cached grpcio_status-1.63.0rc2-py3-none-any.whl (14 kB)
  Using cached grpcio_status-1.63.0rc1-py3-none-any.whl (14 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= -doxygen -Ifaiss -I/private/var/folders/q3/s2px_6w50ks2cxmcc00k3wyh0000gp/T/pip-build-env-j4tnsdqd/overlay/lib/python3.10/site-packages/numpy/core/include -Ifaiss -I/usr/local/include -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

[notice] A new release of pip is available: 23.0.1 -> 24.1
[notice] To update, run: pip install --upgrade pip

Screenshots
n/a

Additional context
n/a

@dosubot dosubot bot added the bug Something isn't working label Jun 24, 2024
Copy link

dosubot bot commented Jun 24, 2024

The error you're encountering is due to the absence of swig, which is required to build the faiss-cpu package from source. Here are a few ways to resolve this issue:

  1. Install swig:
    You can install swig using your package manager. For example, on Ubuntu, you can run:

    sudo apt-get install swig

    On macOS, you can use Homebrew:

    brew install swig
  2. Use an Alternative Installation Method:
    You can avoid building faiss-cpu from source by using alternative installation methods for langflow. Here are a few options:

    • Using HuggingFace Spaces:
      You can run Langflow in the cloud using HuggingFace Spaces, which eliminates the need for local installation and potential dependency issues. Follow the steps here to duplicate and set up Langflow in your own space.

    • Using Docker:
      You can use Docker to run Langflow, which can bypass the need to build faiss-cpu from source. Here is a sample Dockerfile for Langflow:

      FROM langflowai/backend_build as backend_build
      
      FROM python:3.10-slim
      WORKDIR /app
      
      RUN apt-get update && apt-get install git -y
      
      COPY --from=backend_build /app/dist/*.whl /app/
      RUN pip install langflow-*.whl
      RUN rm *.whl
      
      EXPOSE 80
      
      CMD [ "uvicorn", "--host", "0.0.0.0", "--port", "7860", "--factory", "langflow.main:create_app" ]
  3. Install Langflow Using pipx:
    Using pipx might also help avoid building faiss-cpu from source:

    pipx install langflow --python python3.10 --fetch-missing-python

These methods should help you bypass the issue with building faiss-cpu from source and successfully install Langflow [1][2][3].

To continue talking to Dosu, mention @dosu.

@msmygit
Copy link
Contributor Author

msmygit commented Jun 26, 2024

This is the same error even if I remove the -pre from the command - python -m pip install langflow --force-reinstall -U cc/ @rodrigosnader

@mihit
Copy link

mihit commented Jun 26, 2024

@msmygit You don't need --force-reinstall if you just want to use langflow.

@msmygit
Copy link
Contributor Author

msmygit commented Jun 28, 2024

okay. This is what fixed my issue of upgrading from the 1.0.0a61 --> 1.0.5,

python -m pip install langflow -U
Expand/Collapse
```
...
Installing collected packages: smmap, gitdb, gitpython, langchain-mongodb, langchain-aws, langflow-base, langflow
  Attempting uninstall: langflow-base
    Found existing installation: langflow-base 0.0.72
    Uninstalling langflow-base-0.0.72:
      Successfully uninstalled langflow-base-0.0.72
  Attempting uninstall: langflow
    Found existing installation: langflow 1.0.0a61
    Uninstalling langflow-1.0.0a61:
      Successfully uninstalled langflow-1.0.0a61
Successfully installed gitdb-4.0.11 gitpython-3.1.43 langchain-aws-0.1.8 langchain-mongodb-0.1.6 langflow-1.0.5 langflow-base-0.0.81 smmap-5.0.1

[notice] A new release of pip is available: 23.0.1 -> 24.1
[notice] To update, run: pip install --upgrade pip
```

@msmygit msmygit closed this as completed Jun 28, 2024
@msmygit
Copy link
Contributor Author

msmygit commented Jun 28, 2024

Although, it screwed up my existing projects and wiped out everything 🤯 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants