Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install extra packages in Google Colaboratory's VM?

I'm playing with Google Colaboratory, and noticed right off the bat that tqdm is not pre-installed. Is there any way to install additional packages?

like image 886
xperroni Avatar asked Nov 14 '17 01:11

xperroni


People also ask

How do I permanently add library to Google Colab?

You can install the library in Google Drive. Then add the path to sys. path . Then you can install a library, for example, jdc , and specify the target.

Do I have to install packages needed each time when I start Google Colab?

Colab is a great tool for quickly testing Deep Learning models using the free GPU. However, one of its greatest shortcomings compared with Jupyter Notebooks is that you can't install a custom kernel. This means that you need to install all the packages you need every single time.

What packages are available in Google Colab?

Colab environment comes with a number of pre-installed scientific and machine learning packages such as numpy, scipy, pandas, tensorflow, and pytorch.


1 Answers

Yup. You can use pip or apt to install packages as needed.

One example for pip is in the welcome notebook:

!pip install -q matplotlib-venn
from matplotlib_venn import venn2
venn2(subsets = (3, 2, 1))

An example for apt is in the snippets:

!apt update && apt install -y libfluidsynth1

In the case of tdqm, !pip install tqdm worked for me.

like image 90
Bob Smith Avatar answered Oct 12 '22 23:10

Bob Smith