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

Installation Error: command 'swig' failed with exit status 1 #1589

Closed
BrandonLiang opened this issue Dec 22, 2020 · 11 comments
Closed

Installation Error: command 'swig' failed with exit status 1 #1589

BrandonLiang opened this issue Dec 22, 2020 · 11 comments
Labels

Comments

@BrandonLiang
Copy link

Hi,

I am trying to install the DPR library by Facebook (https://github.com/facebookresearch/DPR). Upon installation, I run into the following error, which has issues with Swig and Faiss. I have already installed Swig, but I don't know why it's causing me this error. The developer of DPR advised me to ask SwigFaiss directly about this error (facebookresearch/DPR#87). Appreciate any help, thanks!


Processing /home/xudong/src/DPR
Requirement already satisfied: cython in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from dpr==0.1.0) (0.29.13)
Collecting faiss-cpu>=1.6.1 (from dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/db/bc/ce2ab3fedc051ed037dbede22fedb66df858e7d971ecbb6a27413731aa47/faiss-cpu-1.6.5.tar.gz
Requirement already satisfied: filelock in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from dpr==0.1.0) (3.0.12)
Requirement already satisfied: numpy in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from dpr==0.1.0) (1.17.2)
Requirement already satisfied: regex in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from dpr==0.1.0) (2020.10.23)
Requirement already satisfied: torch>=1.2.0 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from dpr==0.1.0) (1.6.0)
Collecting transformers<3.1.0,>=3.0.0 (from dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/27/3c/91ed8f5c4e7ef3227b4119200fc0ed4b4fd965b1f0172021c25701087825/transformers-3.0.2-py3-none-any.whl
Requirement already satisfied: tqdm>=4.27 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from dpr==0.1.0) (4.38.0)
Collecting wget (from dpr==0.1.0)
Collecting spacy>=2.1.8 (from dpr==0.1.0)
Requirement already satisfied: future in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from torch>=1.2.0->dpr==0.1.0) (0.17.1)
Requirement already satisfied: sacremoses in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from transformers<3.1.0,>=3.0.0->dpr==0.1.0) (0.0.43)
Requirement already satisfied: sentencepiece!=0.1.92 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from transformers<3.1.0,>=3.0.0->dpr==0.1.0) (0.1.91)
Collecting tokenizers==0.8.1.rc1 (from transformers<3.1.0,>=3.0.0->dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/02/59/68c7e3833f535615fb97d33ffcb7b30bbf62bc7477a9c59cd19ad8535d72/tokenizers-0.8.1rc1-cp37-cp37m-manylinux1_x86_64.whl
Requirement already satisfied: requests in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from transformers<3.1.0,>=3.0.0->dpr==0.1.0) (2.22.0)
Requirement already satisfied: packaging in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from transformers<3.1.0,>=3.0.0->dpr==0.1.0) (19.2)
Collecting murmurhash<1.1.0,>=0.28.0 (from spacy>=2.1.8->dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/08/82/917eb137b3e85060e4f7c8dc991fccfafb47aa1f6f59fdd63f406159b03e/murmurhash-1.0.5-cp37-cp37m-manylinux1_x86_64.whl
Collecting srsly<1.1.0,>=1.0.2 (from spacy>=2.1.8->dpr==0.1.0)
Collecting catalogue<1.1.0,>=0.0.7 (from spacy>=2.1.8->dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/6c/f9/9a5658e2f56932e41eb264941f9a2cb7f3ce41a80cb36b2af6ab78e2f8af/catalogue-1.0.0-py2.py3-none-any.whl
Collecting thinc<7.5.0,>=7.4.1 (from spacy>=2.1.8->dpr==0.1.0)
Requirement already satisfied: setuptools in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from spacy>=2.1.8->dpr==0.1.0) (41.4.0)
Collecting plac<1.2.0,>=0.9.6 (from spacy>=2.1.8->dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/86/85/40b8f66c2dd8f4fd9f09d59b22720cffecf1331e788b8a0cab5bafb353d1/plac-1.1.3-py2.py3-none-any.whl
Collecting blis<0.8.0,>=0.4.0 (from spacy>=2.1.8->dpr==0.1.0)
Collecting cymem<2.1.0,>=2.0.2 (from spacy>=2.1.8->dpr==0.1.0)
Collecting wasabi<1.1.0,>=0.4.0 (from spacy>=2.1.8->dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/1b/10/55f3cf6b52cc89107b3e1b88fcf39719392b377a3d78ca61da85934d0d10/wasabi-0.8.0-py3-none-any.whl
Collecting preshed<3.1.0,>=3.0.2 (from spacy>=2.1.8->dpr==0.1.0)
Using cached https://files.pythonhosted.org/packages/af/6e/0605ffc1c3861cce4d029a9724f302232f993fe9d0dc6c04fb7bc49b7852/preshed-3.0.5-cp37-cp37m-manylinux1_x86_64.whl
Requirement already satisfied: joblib in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from sacremoses->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (0.13.2)
Requirement already satisfied: click in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from sacremoses->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (7.0)
Requirement already satisfied: six in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from sacremoses->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (1.12.0)
Requirement already satisfied: idna<2.9,>=2.5 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from requests->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from requests->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (1.25.10)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from requests->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from requests->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (2020.6.20)
Requirement already satisfied: pyparsing>=2.0.2 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from packaging->transformers<3.1.0,>=3.0.0->dpr==0.1.0) (2.4.2)
Requirement already satisfied: importlib-metadata>=0.20; python_version < "3.8" in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from catalogue<1.1.0,>=0.0.7->spacy>=2.1.8->dpr==0.1.0) (0.23)
Requirement already satisfied: zipp>=0.5 in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from importlib-metadata>=0.20; python_version < "3.8"->catalogue<1.1.0,>=0.0.7->spacy>=2.1.8->dpr==0.1.0) (0.6.0)
Requirement already satisfied: more-itertools in /dvmm-filer2/users/xudongliang/anaconda3/lib/python3.7/site-packages (from zipp>=0.5->importlib-metadata>=0.20; python_version < "3.8"->catalogue<1.1.0,>=0.0.7->spacy>=2.1.8->dpr==0.1.0) (7.2.0)
Building wheels for collected packages: dpr, faiss-cpu
Building wheel for dpr (setup.py): started
Building wheel for dpr (setup.py): finished with status 'done'
Created wheel for dpr: filename=dpr-0.1.0-cp37-none-any.whl size=12890 sha256=bd35b84b7bdadf591e2dec063ad786cdd79dcf542d08f18913090af8e794a130
Stored in directory: /tmp/pip-ephem-wheel-cache-e_ji2jh1/wheels/69/bb/b5/a219e73e7dae04a7639db94675b7bb068719a3a4a2129ee867
Building wheel for faiss-cpu (setup.py): started
Building wheel for faiss-cpu (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /dvmm-filer2/users/xudongliang/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-w5fz2us7/faiss-cpu/setup.py'"'"'; file='"'"'/tmp/pip-install-w5fz2us7/faiss-cpu/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-v3z0d3a9 --python-tag cp37
cwd: /tmp/pip-install-w5fz2us7/faiss-cpu/
Complete output (67 lines):
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 -DSWIGWORDSIZE64 -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i
:1: Error: Unable to find 'swig.swg'
:3: Error: Unable to find 'python.swg'
faiss/faiss/python/swigfaiss.i:35: Error: Unable to find 'stdint.i'
faiss/faiss/python/swigfaiss.i:185: Error: Unable to find 'std_string.i'
faiss/faiss/python/swigfaiss.i:186: Error: Unable to find 'std_pair.i'
faiss/faiss/python/swigfaiss.i:187: Error: Unable to find 'std_map.i'
faiss/faiss/python/swigfaiss.i:188: Error: Unable to find 'std_shared_ptr.i'
faiss/faiss/python/swigfaiss.i:229: Error: Unable to find 'faiss/impl/platform_macros.h'
faiss/faiss/python/swigfaiss.i:233: Error: Unable to find 'faiss/utils/ordered_key_value.h'
faiss/faiss/python/swigfaiss.i:234: Error: Unable to find 'faiss/utils/Heap.h'
faiss/faiss/python/swigfaiss.i:235: Error: Unable to find 'faiss/utils/partitioning.h'
faiss/faiss/python/swigfaiss.i:236: Error: Unable to find 'faiss/utils/hamming.h'
faiss/faiss/python/swigfaiss.i:339: Error: Unable to find 'faiss/utils/utils.h'
faiss/faiss/python/swigfaiss.i:340: Error: Unable to find 'faiss/utils/distances.h'
faiss/faiss/python/swigfaiss.i:341: Error: Unable to find 'faiss/utils/random.h'
faiss/faiss/python/swigfaiss.i:343: Error: Unable to find 'faiss/MetricType.h'
faiss/faiss/python/swigfaiss.i:344: Error: Unable to find 'faiss/Index.h'
faiss/faiss/python/swigfaiss.i:345: Error: Unable to find 'faiss/Clustering.h'
faiss/faiss/python/swigfaiss.i:347: Error: Unable to find 'faiss/utils/extra_distances.h'
faiss/faiss/python/swigfaiss.i:351: Error: Unable to find 'faiss/impl/ProductQuantizer.h'
faiss/faiss/python/swigfaiss.i:353: Error: Unable to find 'faiss/VectorTransform.h'
faiss/faiss/python/swigfaiss.i:354: Error: Unable to find 'faiss/IndexPreTransform.h'
faiss/faiss/python/swigfaiss.i:355: Error: Unable to find 'faiss/IndexFlat.h'
faiss/faiss/python/swigfaiss.i:356: Error: Unable to find 'faiss/IndexLSH.h'
faiss/faiss/python/swigfaiss.i:357: Error: Unable to find 'faiss/impl/PolysemousTraining.h'
faiss/faiss/python/swigfaiss.i:358: Error: Unable to find 'faiss/IndexPQ.h'
faiss/faiss/python/swigfaiss.i:359: Error: Unable to find 'faiss/InvertedLists.h'
faiss/faiss/python/swigfaiss.i:360: Error: Unable to find 'faiss/DirectMap.h'
faiss/faiss/python/swigfaiss.i:363: Error: Unable to find 'faiss/IndexIVF.h'
faiss/faiss/python/swigfaiss.i:368: Error: Unable to find 'faiss/IVFlib.h'
faiss/faiss/python/swigfaiss.i:369: Error: Unable to find 'faiss/impl/ScalarQuantizer.h'
faiss/faiss/python/swigfaiss.i:370: Error: Unable to find 'faiss/IndexScalarQuantizer.h'
faiss/faiss/python/swigfaiss.i:371: Error: Unable to find 'faiss/IndexIVFSpectralHash.h'
faiss/faiss/python/swigfaiss.i:372: Error: Unable to find 'faiss/impl/HNSW.h'
faiss/faiss/python/swigfaiss.i:373: Error: Unable to find 'faiss/IndexHNSW.h'
faiss/faiss/python/swigfaiss.i:374: Error: Unable to find 'faiss/IndexIVFFlat.h'
faiss/faiss/python/swigfaiss.i:379: Error: Unable to find 'faiss/OnDiskInvertedLists.h'
faiss/faiss/python/swigfaiss.i:382: Error: Unable to find 'faiss/impl/lattice_Zn.h'
faiss/faiss/python/swigfaiss.i:383: Error: Unable to find 'faiss/IndexLattice.h'
faiss/faiss/python/swigfaiss.i:386: Error: Unable to find 'faiss/IndexIVFPQ.h'
faiss/faiss/python/swigfaiss.i:387: Error: Unable to find 'faiss/IndexIVFPQR.h'
faiss/faiss/python/swigfaiss.i:388: Error: Unable to find 'faiss/Index2Layer.h'
faiss/faiss/python/swigfaiss.i:390: Error: Unable to find 'faiss/IndexBinary.h'
faiss/faiss/python/swigfaiss.i:391: Error: Unable to find 'faiss/IndexBinaryFlat.h'
faiss/faiss/python/swigfaiss.i:392: Error: Unable to find 'faiss/IndexBinaryIVF.h'
faiss/faiss/python/swigfaiss.i:393: Error: Unable to find 'faiss/IndexBinaryFromFloat.h'
faiss/faiss/python/swigfaiss.i:394: Error: Unable to find 'faiss/IndexBinaryHNSW.h'
faiss/faiss/python/swigfaiss.i:395: Error: Unable to find 'faiss/IndexBinaryHash.h'
faiss/faiss/python/swigfaiss.i:397: Error: Unable to find 'faiss/impl/ThreadedIndex.h'
faiss/faiss/python/swigfaiss.i:401: Error: Unable to find 'faiss/IndexShards.h'
faiss/faiss/python/swigfaiss.i:405: Error: Unable to find 'faiss/IndexReplicas.h'
faiss/faiss/python/swigfaiss.i:409: Error: Unable to find 'faiss/MetaIndexes.h'
faiss/faiss/python/swigfaiss.i:594: Error: Unable to find 'faiss/impl/io.h'
faiss/faiss/python/swigfaiss.i:595: Error: Unable to find 'faiss/index_io.h'
faiss/faiss/python/swigfaiss.i:596: Error: Unable to find 'faiss/clone_index.h'
faiss/faiss/python/swigfaiss.i:600: Error: Unable to find 'faiss/AutoTune.h'
faiss/faiss/python/swigfaiss.i:601: Error: Unable to find 'faiss/index_factory.h'
faiss/faiss/python/swigfaiss.i:602: Error: Unable to find 'faiss/MatrixStats.h'
faiss/faiss/python/swigfaiss.i:848: Error: Unable to find 'faiss/impl/AuxIndexStructures.h'
error: command 'swig' failed with exit status 1
ERROR: Failed building wheel for faiss-cpu
Running setup.py clean for faiss-cpu
Successfully built dpr
Failed to build faiss-cpu
Installing collected packages: faiss-cpu, tokenizers, transformers, wget, murmurhash, srsly, catalogue, wasabi, plac, blis, cymem, preshed, thinc, spacy, dpr
Running setup.py install for faiss-cpu: started
Running setup.py install for faiss-cpu: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /dvmm-filer2/users/xudongliang/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-w5fz2us7/faiss-cpu/setup.py'"'"'; file='"'"'/tmp/pip-install-w5fz2us7/faiss-cpu/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ean9py8s/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-w5fz2us7/faiss-cpu/
Complete output (67 lines):
running install
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 -DSWIGWORDSIZE64 -o faiss/faiss/python/swigfaiss_wrap.cpp faiss/faiss/python/swigfaiss.i
:1: Error: Unable to find 'swig.swg'
:3: Error: Unable to find 'python.swg'
faiss/faiss/python/swigfaiss.i:35: Error: Unable to find 'stdint.i'
faiss/faiss/python/swigfaiss.i:185: Error: Unable to find 'std_string.i'
faiss/faiss/python/swigfaiss.i:186: Error: Unable to find 'std_pair.i'
faiss/faiss/python/swigfaiss.i:187: Error: Unable to find 'std_map.i'
faiss/faiss/python/swigfaiss.i:188: Error: Unable to find 'std_shared_ptr.i'
faiss/faiss/python/swigfaiss.i:229: Error: Unable to find 'faiss/impl/platform_macros.h'
faiss/faiss/python/swigfaiss.i:233: Error: Unable to find 'faiss/utils/ordered_key_value.h'
faiss/faiss/python/swigfaiss.i:234: Error: Unable to find 'faiss/utils/Heap.h'
faiss/faiss/python/swigfaiss.i:235: Error: Unable to find 'faiss/utils/partitioning.h'
faiss/faiss/python/swigfaiss.i:236: Error: Unable to find 'faiss/utils/hamming.h'
faiss/faiss/python/swigfaiss.i:339: Error: Unable to find 'faiss/utils/utils.h'
faiss/faiss/python/swigfaiss.i:340: Error: Unable to find 'faiss/utils/distances.h'
faiss/faiss/python/swigfaiss.i:341: Error: Unable to find 'faiss/utils/random.h'
faiss/faiss/python/swigfaiss.i:343: Error: Unable to find 'faiss/MetricType.h'
faiss/faiss/python/swigfaiss.i:344: Error: Unable to find 'faiss/Index.h'
faiss/faiss/python/swigfaiss.i:345: Error: Unable to find 'faiss/Clustering.h'
faiss/faiss/python/swigfaiss.i:347: Error: Unable to find 'faiss/utils/extra_distances.h'
faiss/faiss/python/swigfaiss.i:351: Error: Unable to find 'faiss/impl/ProductQuantizer.h'
faiss/faiss/python/swigfaiss.i:353: Error: Unable to find 'faiss/VectorTransform.h'
faiss/faiss/python/swigfaiss.i:354: Error: Unable to find 'faiss/IndexPreTransform.h'
faiss/faiss/python/swigfaiss.i:355: Error: Unable to find 'faiss/IndexFlat.h'
faiss/faiss/python/swigfaiss.i:356: Error: Unable to find 'faiss/IndexLSH.h'
faiss/faiss/python/swigfaiss.i:357: Error: Unable to find 'faiss/impl/PolysemousTraining.h'
faiss/faiss/python/swigfaiss.i:358: Error: Unable to find 'faiss/IndexPQ.h'
faiss/faiss/python/swigfaiss.i:359: Error: Unable to find 'faiss/InvertedLists.h'
faiss/faiss/python/swigfaiss.i:360: Error: Unable to find 'faiss/DirectMap.h'
faiss/faiss/python/swigfaiss.i:363: Error: Unable to find 'faiss/IndexIVF.h'
faiss/faiss/python/swigfaiss.i:368: Error: Unable to find 'faiss/IVFlib.h'
faiss/faiss/python/swigfaiss.i:369: Error: Unable to find 'faiss/impl/ScalarQuantizer.h'
faiss/faiss/python/swigfaiss.i:370: Error: Unable to find 'faiss/IndexScalarQuantizer.h'
faiss/faiss/python/swigfaiss.i:371: Error: Unable to find 'faiss/IndexIVFSpectralHash.h'
faiss/faiss/python/swigfaiss.i:372: Error: Unable to find 'faiss/impl/HNSW.h'
faiss/faiss/python/swigfaiss.i:373: Error: Unable to find 'faiss/IndexHNSW.h'
faiss/faiss/python/swigfaiss.i:374: Error: Unable to find 'faiss/IndexIVFFlat.h'
faiss/faiss/python/swigfaiss.i:379: Error: Unable to find 'faiss/OnDiskInvertedLists.h'
faiss/faiss/python/swigfaiss.i:382: Error: Unable to find 'faiss/impl/lattice_Zn.h'
faiss/faiss/python/swigfaiss.i:383: Error: Unable to find 'faiss/IndexLattice.h'
faiss/faiss/python/swigfaiss.i:386: Error: Unable to find 'faiss/IndexIVFPQ.h'
faiss/faiss/python/swigfaiss.i:387: Error: Unable to find 'faiss/IndexIVFPQR.h'
faiss/faiss/python/swigfaiss.i:388: Error: Unable to find 'faiss/Index2Layer.h'
faiss/faiss/python/swigfaiss.i:390: Error: Unable to find 'faiss/IndexBinary.h'
faiss/faiss/python/swigfaiss.i:391: Error: Unable to find 'faiss/IndexBinaryFlat.h'
faiss/faiss/python/swigfaiss.i:392: Error: Unable to find 'faiss/IndexBinaryIVF.h'
faiss/faiss/python/swigfaiss.i:393: Error: Unable to find 'faiss/IndexBinaryFromFloat.h'
faiss/faiss/python/swigfaiss.i:394: Error: Unable to find 'faiss/IndexBinaryHNSW.h'
faiss/faiss/python/swigfaiss.i:395: Error: Unable to find 'faiss/IndexBinaryHash.h'
faiss/faiss/python/swigfaiss.i:397: Error: Unable to find 'faiss/impl/ThreadedIndex.h'
faiss/faiss/python/swigfaiss.i:401: Error: Unable to find 'faiss/IndexShards.h'
faiss/faiss/python/swigfaiss.i:405: Error: Unable to find 'faiss/IndexReplicas.h'
faiss/faiss/python/swigfaiss.i:409: Error: Unable to find 'faiss/MetaIndexes.h'
faiss/faiss/python/swigfaiss.i:594: Error: Unable to find 'faiss/impl/io.h'
faiss/faiss/python/swigfaiss.i:595: Error: Unable to find 'faiss/index_io.h'
faiss/faiss/python/swigfaiss.i:596: Error: Unable to find 'faiss/clone_index.h'
faiss/faiss/python/swigfaiss.i:600: Error: Unable to find 'faiss/AutoTune.h'
faiss/faiss/python/swigfaiss.i:601: Error: Unable to find 'faiss/index_factory.h'
faiss/faiss/python/swigfaiss.i:602: Error: Unable to find 'faiss/MatrixStats.h'
faiss/faiss/python/swigfaiss.i:848: Error: Unable to find 'faiss/impl/AuxIndexStructures.h'
error: command 'swig' failed with exit status 1

ERROR: Command errored out with exit status 1: /dvmm-filer2/users/xudongliang/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-w5fz2us7/faiss-cpu/setup.py'"'"'; file='"'"'/tmp/pip-install-w5fz2us7/faiss-cpu/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ean9py8s/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

@mdouze mdouze added the install label Dec 22, 2020
@beauby
Copy link
Contributor

beauby commented Dec 25, 2020

It seems you do not have a full installation of SWIG. Some package managers have separate packages for SWIG and SWIG python.

@beauby beauby closed this as completed Dec 25, 2020
@BrandonLiang
Copy link
Author

BrandonLiang commented Dec 29, 2020

Good suggestion. I followed this link to make sure SWIG is fully installed: https://www.dev2qa.com/how-to-install-swig-on-macos-linux-and-windows/

And the actual key to this is actually faiss-cpu version. The error message results from faiss-cpu version 1.6.5 installation. I tried "pip install faiss-cpu==1.6.1" and it works, as the setup.py in DPR (https://github.com/facebookresearch/DPR/blob/master/setup.py) requires faiss-cpu to be at least 1.6.1.

I suggest some further review on faiss-cpu version 1.6.5.

@alisatl
Copy link

alisatl commented Jun 9, 2021

@BrandonLiang Thank you soooooooo much! After so many hours I've found your solution, thank you man!

@JonhSilver
Copy link

swig.exe -python -c++ -Doverride= -I/usr/local/include -Ifaiss -DSWIGWIN -o faiss\faiss\python\swigfaiss_wrap.cpp faiss\faiss\python\swigfaiss.i
faiss\faiss\python\swigfaiss.i(250) : Error: Unable to find 'faiss\impl\platform_macros.h'

@FelipeHMesquita
Copy link

[...] Using cached rpds_py-0.13.2-cp312-none-win_amd64.whl (189 kB)
Using cached smmap-5.0.1-py3-none-any.whl (24 kB)
Using cached soupsieve-2.5-py3-none-any.whl (36 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.exe -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWIN -module swigfaiss -o faiss\faiss\python\swigfaiss_wrap.cpp faiss\faiss\python\swigfaiss.i
error: command 'swig.exe' failed: None
[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

I'm trying to install but I'm encountering this error. Apparently it's the same problem but when I run the solution offered above I can't do it. Can anyone help?

@bitspike
Copy link

Facing the same issue. Looks like is is an issue with either pyenv or poetry since in the native python installation the pip install faiss-cpu command seems to be working without any extra effort. Not sure how to fix this yet (maybe using docker will allow me to use the thing without issues).

@fynnfluegge
Copy link

same issue here with pyenv, poetry and pipx

@BPDanek
Copy link

BPDanek commented Feb 3, 2024

same issue on poetry

@fynnfluegge
Copy link

fynnfluegge commented Feb 3, 2024

I solved the issue by using python 3.11.x. It seems there is no wheel available for Python 3.12. Using Python 3.11.x works for me with poetrty, conda and pipx.

@githubmuziyi
Copy link

python 3.9 is work

@applecool
Copy link

I was getting the same error while I was installing it in my docker container. I had to downgrade my python docker image to python:3.10 in order to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests