kyamagu / faiss-wheels

Unofficial faiss wheel builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects in linux Alpine

pfcstyle opened this issue · comments

Describe the bug
Can't build wheels.

To Reproduce

pip install faiss-cpu

Expected behavior

#11 827.7       swigging faiss/faiss/python/swigfaiss.i to faiss/faiss/python/swigfaiss_wrap.cpp
#11 827.7       swig -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWORDSIZE64 -module swigfaiss -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i
#11 827.7       faiss/faiss/python/swigfaiss.i:268: Error: Unable to find 'faiss/impl/platform_macros.h'
#11 827.7       faiss/faiss/python/swigfaiss.i:272: Error: Unable to find 'faiss/utils/ordered_key_value.h'
#11 827.7       faiss/faiss/python/swigfaiss.i:273: Error: Unable to find 'faiss/utils/Heap.h'
#11 827.7       faiss/faiss/python/swigfaiss.i:278: Error: Unable to find 'faiss/utils/AlignedTable.h'

...

#11 827.7       [end of output]
#11 827.7   
#11 827.7   note: This error originates from a subprocess, and is likely not a problem with pip.
#11 827.7   ERROR: Failed building wheel for faiss-cpu
#11 827.7 Successfully built numexpr numpy PyYAML
#11 827.7 Failed to build faiss-cpu
#11 827.7 ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects

Desktop (please complete the following information):

  • OS: Alpine
  • Architecture: x86_64
  • Python: 3.10.12
  • Version: v1.7.4
  • swig: 4.1.1
  • pip: 23.2.1(latest)

Likely an issue with swig version compatibility

I downgraded swig version to 4.0.2, the error is same.

#12 [python 2/4] RUN echo "swig path" &&   which swig &&   echo "swig version" &&   swig -version
#12 0.493 swig path
#12 0.497 /usr/bin/swig
#12 0.498 swig version
#12 0.704 
#12 0.704 SWIG Version 4.0.2

#14 871.4       building 'faiss._swigfaiss' extension
#14 871.4       swigging faiss/faiss/python/swigfaiss.i to faiss/faiss/python/swigfaiss_wrap.cpp
#14 871.4       swig -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWORDSIZE64 -module swigfaiss -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i
#14 871.4       faiss/faiss/python/swigfaiss.i:268: Error: Unable to find 'faiss/impl/platform_macros.h'
#14 871.4       faiss/faiss/python/swigfaiss.i:272: Error: Unable to find 'faiss/utils/ordered_key_value.h'
#14 871.4       faiss/faiss/python/swigfaiss.i:273: Error: Unable to find 'faiss/utils/Heap.h'
#14 871.4       faiss/faiss/python/swigfaiss.i:278: Error: Unable to find 'faiss/utils/AlignedTable.h'
#14 871.4       faiss/faiss/python/swigfaiss.i:279: Error: Unable to find 'faiss/utils/partitioning.h'
#14 871.4       faiss/faiss/python/swigfaiss.i:280: Error: Unable to find 'faiss/utils/hamming.h'
#14 871.4       faiss/faiss/python/swigfaiss.i:281: Error: Unable to find 'faiss/utils/hamming_distance/common.h'
...
#14 871.4       faiss/faiss/python/swigfaiss.i:760: Error: Unable to find 'faiss/MatrixStats.h'
#14 871.4       error: command '/usr/bin/swig' failed with exit code 1
#14 871.4       [end of output]
#14 871.4   
#14 871.4   note: This error originates from a subprocess, and is likely not a problem with pip.
#14 871.4   ERROR: Failed building wheel for faiss-cpu
#14 871.4 Successfully built numexpr numpy PyYAML
#14 871.4 Failed to build faiss-cpu
#14 871.4 ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects

Tried: python:3.9.17, swig:4.0.2, faiss-cpu:1.7.2, python:3.8.15, swig:4.0.2, faiss-cpu:1.7.4, same error, no lucky

python:3.10.12, swig:3.0.12-r4, faiss-cpu:1.7.4, still failed, looks like swig=3.0.12 is too low.

#14 [python 4/4] RUN pip3 install faiss-cpu==1.7.4
#14 1.286 Collecting faiss-cpu==1.7.4
#14 1.384   Downloading faiss-cpu-1.7.4.tar.gz (57 kB)
#14 1.416      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.4/57.4 kB 1.9 MB/s eta 0:00:00
#14 1.500   Installing build dependencies: started
#14 76.89   Installing build dependencies: still running...
#14 179.7   Installing build dependencies: still running...
#14 243.0   Installing build dependencies: still running...
#14 312.8   Installing build dependencies: still running...
#14 373.2   Installing build dependencies: still running...
#14 384.8   Installing build dependencies: finished with status 'done'
#14 384.8   Getting requirements to build wheel: started
#14 385.1   Getting requirements to build wheel: finished with status 'done'
#14 385.1   Preparing metadata (pyproject.toml): started
#14 385.5   Preparing metadata (pyproject.toml): finished with status 'done'
#14 385.5 Building wheels for collected packages: faiss-cpu
#14 385.5   Building wheel for faiss-cpu (pyproject.toml): started
#14 385.9   Building wheel for faiss-cpu (pyproject.toml): finished with status 'error'
#14 385.9   error: subprocess-exited-with-error
#14 385.9   
#14 385.9   × Building wheel for faiss-cpu (pyproject.toml) did not run successfully.
#14 385.9   │ exit code: 1
#14 385.9   ╰─> [10 lines of output]
#14 385.9       running bdist_wheel
#14 385.9       running build
#14 385.9       running build_py
#14 385.9       running build_ext
#14 385.9       building 'faiss._swigfaiss' extension
#14 385.9       swigging faiss/faiss/python/swigfaiss.i to faiss/faiss/python/swigfaiss_wrap.cpp
#14 385.9       swig -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWORDSIZE64 -module swigfaiss -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i
#14 385.9       swig error : Unrecognized option -doxygen
#14 385.9       Use 'swig -help' for available options.
#14 385.9       error: command '/usr/bin/swig' failed with exit code 1
#14 385.9       [end of output]
#14 385.9   
#14 385.9   note: This error originates from a subprocess, and is likely not a problem with pip.
#14 385.9   ERROR: Failed building wheel for faiss-cpu
#14 385.9 Failed to build faiss-cpu
#14 385.9 ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects

Ok, then did you already install faiss in the system? The faiss itself must be already available to build a wrapper.

Looks can't build faiss on alpine facebookresearch/faiss#468

I changed my docker image to ubuntu, it works.