Installing faiss on Google Colaboratory

随声附和 提交于 2019-12-21 05:09:13

问题


I try to follow instruction on the MUSE project.

They require PyTorch and Faiss. PyTorch is easy to install. But I found problem with installing Faiss.

The instruction on MUSE tell me to use

conda install faiss-cpu -c pytorch

But Google Colab doesn't support conda (When I tried !pip install conda, it didn't work)

And Faiss didn't work when I !pip install faiss either.

Is there a way to install Faiss or conda?


回答1:


Here's how I eventually install faiss.

!wget  https://anaconda.org/pytorch/faiss-cpu/1.2.1/download/linux-64/faiss-cpu-1.2.1-py36_cuda9.0.176_1.tar.bz2
!tar xvjf faiss-cpu-1.2.1-py36_cuda9.0.176_1.tar.bz2
!cp -r lib/python3.6/site-packages/* /usr/local/lib/python3.6/dist-packages/
!pip install mkl

Then, I can import faiss with no problem. The warning is that I didn't use GPU. If you want to use GPU, you need to install this instead:

https://anaconda.org/pytorch/faiss-gpu/1.2.1/download/linux-64/faiss-gpu-1.2.1-py36_cuda9.0.176_1.tar.bz2




回答2:


Try this way!

  1. install conda

    !wget -c -O anaconda.sh 'https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh'

    !bash anaconda.sh -b

    !cd /usr/bin/ && ln -sf /content/anaconda3/bin/conda conda

    !cd /content/

  2. install faiss

    !yes y | conda install faiss-gpu -c pytorch



来源:https://stackoverflow.com/questions/47967252/installing-faiss-on-google-colaboratory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!