Installing Anaconda in Google Colab

Installing Anaconda in Google Colab

We often use Google Colab because of the several benefits like pre-installed libraries, saved on the cloud, collaboration and free GPU and TPU, etc. Sometimes we need anaconda environment for our project. Today we will see how to set up anaconda environment in Google Colab.

Copy, paste, and run the following code into Google Colab

Download & Install

%%bash

MINICONDA_INSTALLER_SCRIPT=Miniconda3-4.5.4-Linux-x86_64.sh
MINICONDA_PREFIX=/usr/local
wget https://repo.continuum.io/miniconda/$MINICONDA_INSTALLER_SCRIPT
chmod +x $MINICONDA_INSTALLER_SCRIPT
./$MINICONDA_INSTALLER_SCRIPT -b -f -p $MINICONDA_PREFIX

Check out the environment

!which conda # should return /usr/local/bin/conda

!conda --version # should return 4.5.4

!which python # still returns /usr/local/bin/python

!python --version # now returns Python 3.6.5 :: Anaconda, Inc.


Updating

%%bash

conda install --channel defaults conda python=3.6 --yes

conda update --channel defaults --all --yes

!conda --version # now returns 4.8.3

!python --version # now returns Python 3.6.10 :: Anaconda, Inc.

Installing packages

!conda install pytorch=1.1.0 torchvision=0.3.0 cudatoolkit=9.0 -c pytorch

Thanks for reading! Let me know if you have any feedback.



要查看或添加评论,请登录

Md Rasel Khondokar的更多文章

社区洞察

其他会员也浏览了