安装faiss失败

这个问题官方已经说了,不支持win下的。

所以可能不管是安装-cpu或者-gpu都不行的,无论有没有gpu

pip install faiss-cpu
Collecting faiss-cpu
  Using cached https://files.pythonhosted.org/packages/6b/79/3fc59c466abcfed5fa9b40915a6564576b7615ac9201eac67156730262c7/faiss-cpu-1.6.3.tar.gz
Requirement already satisfied: numpy in d:\python\lib\site-packages (from faiss-cpu) (1.16.4)
Building wheels for collected packages: faiss-cpu
  Running setup.py bdist_wheel for faiss-cpu ... error
  Complete output from command d:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xulm1\\AppData\\Local\\Temp\\pip-install-4lyhcysd\\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 C:\Users\xulm1\AppData\Local\Temp\pip-wheel-m28o98m3 --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  Traceback (most recent call last):
    File "", line 1, in 
    File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 107, in 
      ext_modules=[_swigfaiss]
    File "d:\python\lib\site-packages\setuptools\__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "d:\python\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "d:\python\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "d:\python\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "d:\python\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "d:\python\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\python\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "d:\python\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "d:\python\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\python\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 45, in run
      build_ext.run(self)
    File "d:\python\lib\distutils\command\build_ext.py", line 339, in run
      self.build_extensions()
    File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 50, in build_extensions
      self._remove_flag('-Wstrict-prototypes')
    File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 58, in _remove_flag
      compiler = self.compiler.compiler
  AttributeError: 'MSVCCompiler' object has no attribute 'compiler'

  ----------------------------------------
  Failed building wheel for faiss-cpu
  Running setup.py clean for faiss-cpu
Failed to build faiss-cpu
Installing collected packages: faiss-cpu
  Running setup.py install for faiss-cpu ... error
    Complete output from command d:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xulm1\\AppData\\Local\\Temp\\pip-install-4lyhcysd\\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 C:\Users\xulm1\AppData\Local\Temp\pip-record-ji80tsyq\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    Traceback (most recent call last):
      File "", line 1, in 
      File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 107, in 
        ext_modules=[_swigfaiss]
      File "d:\python\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "d:\python\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "d:\python\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "d:\python\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "d:\python\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "d:\python\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "d:\python\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\python\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "d:\python\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "d:\python\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\python\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 45, in run
        build_ext.run(self)
      File "d:\python\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 50, in build_extensions
        self._remove_flag('-Wstrict-prototypes')
      File "C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\setup.py", line 58, in _remove_flag
        compiler = self.compiler.compiler
    AttributeError: 'MSVCCompiler' object has no attribute 'compiler'

    ----------------------------------------
Command "d:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xulm1\\AppData\\Local\\Temp\\pip-install-4lyhcysd\\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 C:\Users\xulm1\AppData\Local\Temp\pip-record-ji80tsyq\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\xulm1\AppData\Local\Temp\pip-install-4lyhcysd\faiss-cpu\

目前只支持Linux和mac 版本的。

补充:20200530

另外需要cuda是9.0版本以上的才可以支持,其他低版本还是出错。如下

  building 'faiss._swigfaiss' extension
  swigging python/swigfaiss.i to python/swigfaiss_wrap.cpp
  swig -python -c++ -Doverride= -I/usr/local/include/faiss -I/usr/local/cuda/include -DGPU_WRAPPER -DSWIGWORDSIZE64 -o python/swigfaiss_wrap.cpp python/swigfaiss.i
  unable to execute 'swig': No such file or directory
  error: command 'swig' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for faiss-gpu
  Running setup.py clean for faiss-gpu
Failed to build faiss-gpu
Installing collected packages: faiss-gpu
  Running setup.py install for faiss-gpu ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-3r_2kgnv/faiss-gpu/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-clvvmm8s/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'faiss._swigfaiss' extension
    swigging python/swigfaiss.i to python/swigfaiss_wrap.cpp
    swig -python -c++ -Doverride= -I/usr/local/include/faiss -I/usr/local/cuda/include -DGPU_WRAPPER -DSWIGWORDSIZE64 -o python/swigfaiss_wrap.cpp python/swigfaiss.i
    unable to execute 'swig': No such file or directory
    error: command 'swig' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-3r_2kgnv/faiss-gpu/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-clvvmm8s/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-3r_2kgnv/faiss-gpu/

For Video Recommendation in Deep learning QQ Group 277356808

For Speech, Image, Video in deep learning QQ Group 868373192

I'm here waiting for you.
 

你可能感兴趣的:(Recommendation)