Installing faiss on Google Colaboratory - pip

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?

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
Update June 2020
As #Kuffner said, you can now use !pip to install it. (I test and simplify it a bit)
For CPU
!apt install libomp-dev
!pip install faiss
For GPU
!pip install faiss-gpu

As of June 2020 the easiest solution for Colab GPU runtime is:
!apt install libomp-dev
!python -m pip install --upgrade faiss faiss-gpu
import faiss
The code comes from here: faiss/issues/890

Try this solution, it should work!
!pip install faiss-cpu --no-cache

Try this way!
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/
install faiss
!yes y | conda install faiss-gpu -c pytorch

Related

Unable to install python graphviz package

When I am trying to install python-graphviz package on IBM Cloud as part of my final assignment for the course - ML with Python, I'm getting the following errors
ERROR: Could not find a version that satisfies the requirement python-graphviz (from versions: none)
ERROR: No matching distribution found for python-graphviz
The command I used is as follows:
!pip install python-graphviz
As per the lab instructions, the following commands to install pydotplus and python-graphviz didn't work.
#!conda install -c conda-forge pydotplus -y
#!conda install -c conda-forge python-graphviz -y
To summarize,
!pip install pydotplus ## THIS IS WORKING.
#!conda install -c conda-forge pydotplus -y ## THIS IS NOT WORKING
!pip install python-graphviz ## THIS IS NOT WORKING
#!conda install -c conda-forge python-graphviz -y ## THIS IS ALSO NOT WORKING.
Please advise me with the right instruction set - whether PIP or CONDA.
Thanks.
Regards,
Vasan S T
Try pip install graphviz after upgrading pip.

How to Install Zipline on Google Colab

!apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev hdf5-tools
!pip install zipline
!pip install zipline ingest
!pip uninstall pandas
!pip install --upgrade pandas==0.23.0
%load_ext zipline
I have following issue:
ValueError: index must be monotonic increasing or decreasing
after adding cuperto suggested (!pip install pandas==0.22.0),
I got this error:
enter image description here
any suggestion?
Trying to run Zipline on Google Colab, I ran into the exact same problem.
I believe the problem comes from the fact that zipline 1.4.1 has requirement pandas<=0.22,>=0.18.1
So I installed an older version of pandas and it worked:
!pip install pandas==0.22.0

Python 3.6: how to install rubberband?

I want to use this function, and I'm trying to install rubberband using pip as the following: pip install rubberband
But, it raises the following error: "Failed building wheel for rubberband"
And I can't use Python 3.5 in my project. So, how to install rubberband?
P.S. My OS is Windows 10, and I have python 3.6 on it.
The docs you pointed to are the docs for the project pyrubberband, not rubberband. So install it with pip install pyrubberband.
As for rubberband: you probably need a C/C++ compiler to install it.
Upd. pyrubberband is a Python wrapper for rubberband. You need to install it, see https://breakfastquay.com/rubberband/index.html
To make a long story short, this is how I installed the rubberband python package.
apt update
apt-get install libsndfile-dev
apt-get install librubberband-dev
python3 -m pip install numpy (required for rubberband)
Note that the -dev postfix is required to get the header files that are later required for the python rubberband package to be able to compile the package.
Later, pip install rubberband failed on transform is not a member of std.
To solve that, I did the following:
python3 -m pip download rubberband
tar -xf rubberband-1.0.2.tar.gz
edit rubberband-1.0.2/src/numpy.cpp - add #include <algorithm> at the top of the file.
cd rubberband-1.0.2 and then run python3 -m pip install . or better yet python setup.py bdist_wheel --universal to create a whl file to add to your docker dependencies.
If you ran through this and using macOS, brew for everything works
$ brew install rubberband
Works like charm https://formulae.brew.sh/formula/rubberband
Install "rubberband-cli" Package on Ubuntu:
sudo apt-get update -y
sudo apt-get install -y rubberband-cli

how to install fastai on windows 10

I cant seem to install the right version of torch and I cant get fast ai libraries working
I try
Python 3.7
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
No matching distribution found for torch>=1.1.0 (from torchvision)
I feel like I may of downgraded my gpu when I tried conda install fast ai
and then I tried pip and it couldnt find a file C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\caffe2\python\serialized_test\data\operator_test
I finally got to the point where it said successfully installed six, pillow, and torch but torch is at 0.3 which is incompatiable.
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
expected to install pytorch or fastai nothing seems to work
You may try installing the course by creating a conda environment provided anaconda is already installed in your windows machine.
conda update conda
conda create -n fastai_conda python=3.6
conda activate fastai_conda
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge
Or for installing CPU version you can use the below commands after the environment is created
conda install -c pytorch pytorch-cpu torchvision
conda install -c fastai fastai
You can check if installation went right with this command
python -m fastai.utils.show_install
You may further need to install ipykernel to use the conda environment in your jupyter notebook.For that activate environment and run the following commands:
conda install nb_conda_kernels
python -m ipykernel install --user --name fastai_v1 --display-name "fastai v1"
conda install ipywidgets

Can not find the shared library:libhdfs3.so

everyone. I'm try to used Dask with Distributed + HDFS for processing some files. when I installed the distributed try to install the HDFS3 plugins, the error was :
Can not find the shared library:libhdfs3.so
My environment is Ubuntu 16 Desktop version. I strict according to bewlo, but still not working. Hope someone can help! Thanks a lot
conda install hdfs3 -c conda-forge
echo "deb https://dl.bintray.com/wangzw/deb trusty contrib" | sudo tee /etc/apt/sources.list.d/bintray-wangzw-deb.list
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install libhdfs3 libhdfs3-dev
pip install hdfs3
If you are not using conda and you are using pip, you can also face this error
Can not find the shared library:libhdfs3.so
To ensure requirements in this page https://github.com/ContinuumIO/libhdfs3-downstream/tree/master/libhdfs3
solved my problem.
There are packages that you should install, if you are installing with pip:
cmake (2.8+) http://www.cmake.org/
boost (tested on 1.53+) http://www.boost.org/
google protobuf http://code.google.com/p/protobuf/
libxml2 http://www.xmlsoft.org/
kerberos http://web.mit.edu/kerberos/
libuuid http://sourceforge.net/projects/libuuid/
libgsasl http://www.gnu.org/software/gsasl/ (need https://github.com/bdrosen96/libgsasl)
openssl https://www.openssl.org/
P.S.: OS: Centos7
Since no one answers this question and I figure out the solution by myself , at least it works for me.
conda install libhdfs3
pip install libhdfs3
conda install -c clinicalgraphics libgcrypt11
conda install libprotobuf=2.5
conda update libhdfs3
if still not work try to update.

Resources