Search
Google Colab

In the Colab project, Google is providing some pretty impressive free computer resources (free compute, storage, and networking). Anyone with a Google identity (say, a gmail address) will be provisioned with up to two simultaneous VMs. Google kills off machines after at most 12 hours (that's to prevent crypomining squatters from infesting the system). (Google's FAQ is noncommital about QoS, but then it is free.)

Each VM can have an GPU (optionally even a TPU, subject to availability). Google Drive starts at 15 GB free presistant storage. The VMs can have as much as 350 GB of transient storage. And all that comes no admin costs except deciding who to share documents with.

Think of Colab as the newest member of the Google office apps suite: gMail, Sheets, Docs, Slides, etc. Colab is Google bringing Jupyter into their stable. Whereas in Sheets, Google runs arbitrary user code in JavaScript on spreadsheets, in Colab Google runs arbitrary user code in Python on Jupyter notebooks.

This project is a thought experiment leveraging Colab to a logical conclusion: a fully static website, with Colab as an optional execution backend which will crunch hard for 12 hours on, say, micrography object recognition or transcriptomic visualization.

Integrating Google Colaboratory into Your Machine Learning Workflow is an example of how folks are adopting Colab into their development environment.

(c) Nico Holmberg

Installs and imports

First let's take care of various installs of packages imported within this notebook.

!pip install humanize
!pip install gputil
!pip install psutil
Requirement already satisfied: humanize in /usr/local/lib/python3.6/dist-packages (0.5.1)
Collecting gputil
  Downloading https://files.pythonhosted.org/packages/ed/0e/5c61eedde9f6c87713e89d794f01e378cfd9565847d4576fa627d758c554/GPUtil-1.4.0.tar.gz
Building wheels for collected packages: gputil
  Building wheel for gputil (setup.py) ... done
  Created wheel for gputil: filename=GPUtil-1.4.0-cp36-none-any.whl size=7410 sha256=d360f101e337d5ed0b6e1b519c5862c1199837dff982e7d26d20c207e6644a23
  Stored in directory: /root/.cache/pip/wheels/3d/77/07/80562de4bb0786e5ea186911a2c831fdd0018bda69beab71fd
Successfully built gputil
Installing collected packages: gputil
Successfully installed gputil-1.4.0
Requirement already satisfied: psutil in /usr/local/lib/python3.6/dist-packages (5.4.8)
import humanize
import platform
import psutil
import os
# Request TF 2.x, not 1.x
try:
  # %tensorflow_version is a Colab-only thing 
  %tensorflow_version 2.x
except Exception:
  print("TensorFlow 2.x does not seem to be available")
TensorFlow 2.x selected.

Python environment

What version of Python is in effect?

a_message = "Python runtime version: " + platform.python_version() 
print(a_message)
Python runtime version: 3.6.9

What packages are installed for the detected running version of Python?

python_major_version = int(platform.python_version_tuple()[0])
print(python_major_version)

if python_major_version == 3:
  print("Python 3.6 dist-packages")
  !ls /usr/local/lib/python3.6/dist-packages
else: 
  # Python 2 it is...
  print("Python 2.7 dist-packages")
  !ls /usr/local/lib/python2.7/dist-packages
3
Python 3.6 dist-packages
absl
absl_py-0.9.0.dist-info
alabaster
alabaster-0.7.12.dist-info
albumentations
albumentations-0.1.12.dist-info
altair
altair-4.0.0.dist-info
apiclient
asgiref
asgiref-3.2.3.dist-info
astor
astor-0.8.1.dist-info
astropy
astropy-4.0.dist-info
atari_py
atari_py-0.2.6.dist-info
atomicwrites
atomicwrites-1.3.0.dist-info
attr
attrs-19.3.0.dist-info
audioread
audioread-2.1.8.dist-info
autograd
autograd-1.3.dist-info
babel
Babel-2.8.0.dist-info
backcall
backcall-0.1.0.dist-info
backports
backports.tempfile-1.0.dist-info
backports.weakref-1.0.post1.dist-info
beautifulsoup4-4.6.3.dist-info
bin
bleach
bleach-3.1.0.dist-info
blis
blis-0.2.4.dist-info
bokeh
bokeh-1.4.0.dist-info
boto
boto-2.49.0.dist-info
boto3
boto3-1.10.47.dist-info
botocore
botocore-1.13.47.dist-info
bottleneck
Bottleneck-1.3.1.dist-info
branca
branca-0.3.1.dist-info
bs4
bs4-0.0.1.dist-info
bson
bz2file-0.98.dist-info
bz2file.py
cachetools
cachetools-4.0.0.dist-info
caffe2
certifi
certifi-2019.11.28.dist-info
cffi
cffi-1.13.2.dist-info
_cffi_backend.cpython-36m-x86_64-linux-gnu.so
chainer
chainer-6.5.0.dist-info
chainermn
chainerx
chardet
chardet-3.0.4.dist-info
chart_studio
chart_studio-1.0.0.dist-info
chess
click
Click-7.0.dist-info
client
cloudpickle
cloudpickle-1.2.2.dist-info
cmake
cmake-3.12.0.dist-info
colab
colorlover
colorlover-0.3.0.dist-info
community
community-1.0.0b1.dist-info
contextlib2-0.5.5.dist-info
contextlib2.py
convertdate
convertdate-2.2.0.dist-info
coverage
coverage-3.7.1.dist-info
coveralls
coveralls-0.5.dist-info
crcmod
crcmod-1.7.dist-info
cufflinks
cufflinks-0.17.0.dist-info
cupy
cupy_cuda101-6.5.0.dist-info
cupyx
cv2
_cvxcore.cpython-36m-x86_64-linux-gnu.so
cvxopt
cvxopt-1.2.3.dist-info
cvxpy
cvxpy-1.0.25.dist-info
cycler-0.10.0.dist-info
cycler.py
cymem
cymem-2.0.3.dist-info
Cython
Cython-0.29.14.dist-info
cython.py
daft-0.0.4.dist-info
daft.py
dask
dask-2.9.1.dist-info
dataclasses-0.7.dist-info
dataclasses.py
datascience
datascience-0.10.6.dist-info
dateutil
decorator-4.4.1.dist-info
decorator.py
defusedxml
defusedxml-0.6.0.dist-info
descartes
descartes-1.1.0.dist-info
dill
dill-0.3.1.1.dist-info
distributed
distributed-1.25.3.dist-info
django
Django-3.0.2.dist-info
dlib-19.18.0.dist-info
dlib.cpython-36m-x86_64-linux-gnu.so
dm_sonnet-1.35.dist-info
docopt-0.6.2.dist-info
docopt.py
docs
docutils
docutils-0.15.2.dist-info
dopamine
dopamine_rl-1.0.5.dist-info
dot_parser.py
earthengine_api-0.1.209.dist-info
easydict
easydict-1.9.dist-info
easy_install.py
ecos
ecos-2.0.7.post1.dist-info
_ecos.cpython-36m-x86_64-linux-gnu.so
editdistance
editdistance-0.5.3.dist-info
ee
en_core_web_sm
en_core_web_sm-2.1.0.dist-info
entrypoints-0.3.dist-info
entrypoints.py
et_xmlfile
et_xmlfile-1.0.1.dist-info
examples
fa2
fa2-0.3.5.dist-info
fancyimpute
fancyimpute-0.4.3.dist-info
fastai
fastai-1.0.60.dist-info
fastcache
fastcache-1.1.0.dist-info
fastdtw
fastdtw-0.3.4.dist-info
fastprogress
fastprogress-0.2.2.dist-info
fastrlock
fastrlock-0.4.dist-info
fbprophet
fbprophet-0.5.dist-info
feather
feather_format-0.4.0.dist-info
featuretools
featuretools-0.4.1.dist-info
filelock-3.0.12.dist-info
filelock.py
fix_yahoo_finance
fix_yahoo_finance-0.0.22.dist-info
flask
Flask-1.1.1.dist-info
folium
folium-0.8.3.dist-info
fsspec
fsspec-0.6.2.dist-info
future
future-0.16.0.dist-info
gast
gast-0.2.2.dist-info
gdown
gdown-3.6.4.dist-info
gensim
gensim-3.6.0.dist-info
geographiclib
geographiclib-1.50.dist-info
geopy
geopy-1.17.0.dist-info
gevent
gevent-1.4.0.dist-info
gin
gin_config-0.3.0.dist-info
github2pypi
glob2
glob2-0.7.dist-info
google
google-2.0.3.dist-info
googleapiclient
google_api_core-1.15.0.dist-info
google_api_core-1.15.0-py3.8-nspkg.pth
google_api_python_client-1.7.11.dist-info
googleapis_common_protos-1.6.0.dist-info
googleapis_common_protos-1.6.0-py3.6-nspkg.pth
google_auth-1.4.2.dist-info
google_auth-1.4.2-py2.7-nspkg.pth
google_auth_httplib2-0.0.3.dist-info
google_auth_httplib2.py
google_auth_oauthlib
google_auth_oauthlib-0.4.1.dist-info
google_cloud_bigquery-1.21.0.dist-info
google_cloud_bigquery-1.21.0-py3.6-nspkg.pth
google_cloud_core-1.0.3.dist-info
google_cloud_core-1.0.3-py3.6-nspkg.pth
google_cloud_datastore-1.8.0.dist-info
google_cloud_datastore-1.8.0-py3.6-nspkg.pth
google_cloud_language-1.2.0.dist-info
google_cloud_language-1.2.0-py3.6-nspkg.pth
google_cloud_storage-1.16.2.dist-info
google_cloud_storage-1.16.2-py3.7-nspkg.pth
google_cloud_translate-1.5.0.dist-info
google_cloud_translate-1.5.0-py3.6-nspkg.pth
google_colab-1.0.0.dist-info
google_colab-1.0.0-py3.6-nspkg.pth
google_drive_downloader
googledrivedownloader-0.4.dist-info
google_pasta-0.1.8.dist-info
google_resumable_media-0.4.1.dist-info
google_resumable_media-0.4.1-py3.6-nspkg.pth
googlesearch
GPUtil
GPUtil-1.4.0.dist-info
graph_nets
graph_nets-1.0.5.dist-info
graphviz
graphviz-0.10.1.dist-info
greenlet-0.4.15.dist-info
greenlet.cpython-36m-x86_64-linux-gnu.so
gridfs
grpc
grpcio-1.15.0.dist-info
gspread
gspread-3.0.1.dist-info
gspread_dataframe-3.0.3.dist-info
gspread_dataframe.py
gunicorn
gunicorn-20.0.4.dist-info
gym
gym-0.15.4.dist-info
h5py
h5py-2.8.0.dist-info
HeapDict-1.0.1.dist-info
heapdict.py
helper
holidays-0.9.12.dist-info
holidays.py
html5lib
html5lib-1.0.1.dist-info
httpimport-0.5.18.dist-info
httpimport.py
httplib2
httplib2-0.11.3.dist-info
humanize
humanize-0.5.1.dist-info
hyperopt
hyperopt-0.1.2.dist-info
ideep4py
ideep4py-2.0.0.post3.dist-info
idna
idna-2.8.dist-info
image
image-1.5.27.dist-info
imageio
imageio-2.4.1.dist-info
imagesize-1.2.0.dist-info
imagesize.py
imbalanced_learn-0.4.3.dist-info
imblearn
imblearn-0.0.dist-info
imgaug
imgaug-0.2.9.dist-info
importlib_metadata
importlib_metadata-1.4.0.dist-info
imutils
imutils-0.5.3.dist-info
inflect-2.1.0.dist-info
inflect.py
intel_openmp-2020.0.133.dist-info
intervaltree
intervaltree-2.1.0.dist-info
ipykernel
ipykernel-4.6.1.dist-info
ipykernel_launcher.py
IPython
ipython-5.5.0.dist-info
ipython_genutils
ipython_genutils-0.2.0.dist-info
ipython_sql-0.3.9.dist-info
ipywidgets
ipywidgets-7.5.1.dist-info
itsdangerous
itsdangerous-1.1.0.dist-info
jax
jax-0.1.52.dist-info
jaxlib
jaxlib-0.1.36.dist-info
jdcal-1.4.1.dist-info
jdcal.py
jedi
jedi-0.15.2.dist-info
jieba
jieba-0.40.dist-info
jinja2
Jinja2-2.10.3.dist-info
jmespath
jmespath-0.9.4.dist-info
joblib
joblib-0.14.1.dist-info
jpeg4py
jpeg4py-0.1.4.dist-info
jsonschema
jsonschema-2.6.0.dist-info
jupyter-1.0.0.dist-info
jupyter_client
jupyter_client-5.3.4.dist-info
jupyter_console
jupyter_console-5.2.0.dist-info
jupyter_core
jupyter_core-4.6.1.dist-info
jupyter.py
kaggle
kaggle-1.5.6.dist-info
kapre
kapre-0.1.3.1.dist-info
keras
Keras-2.2.5.dist-info
keras_applications
Keras_Applications-1.0.8.dist-info
keras_preprocessing
Keras_Preprocessing-1.1.0.dist-info
keras_vis-0.4.1.dist-info
kfac
kfac-0.2.0.dist-info
kiwisolver-1.1.0.dist-info
kiwisolver.cpython-36m-x86_64-linux-gnu.so
knnimpute
knnimpute-0.1.0.dist-info
libfuturize
libpasteurize
librosa
librosa-0.6.3.dist-info
lightgbm
lightgbm-2.2.3.dist-info
llvmlite
llvmlite-0.31.0.dist-info
lmdb
lmdb-0.98.dist-info
lucid
lucid-0.3.8.dist-info
lunardate-0.2.0.dist-info
lunardate.py
lxml
lxml-4.2.6.dist-info
magenta
magenta-0.3.19.dist-info
markdown
Markdown-3.1.1.dist-info
markupsafe
MarkupSafe-1.1.1.dist-info
matplotlib
matplotlib-3.1.2.dist-info
matplotlib-3.1.2-py3.6-nspkg.pth
matplotlib_venn
matplotlib_venn-0.11.5.dist-info
mesh_tensorflow
mesh_tensorflow-0.1.8.dist-info
mido
mido-1.2.6.dist-info
mir_eval
mir_eval-0.5.dist-info
missingno
missingno-0.4.2.dist-info
mistune-0.8.4.dist-info
mistune.py
mizani
mizani-0.6.0.dist-info
mkl-2019.0.dist-info
mlxtend
mlxtend-0.14.0.dist-info
more_itertools
more_itertools-8.0.2.dist-info
moviepy
moviepy-0.2.3.5.dist-info
mpi4py
mpi4py-3.0.3.dist-info
mpl_toolkits
mpmath
mpmath-1.1.0.dist-info
msgpack
msgpack-0.5.6.dist-info
multiprocess
_multiprocess
multiprocess-0.70.9.dist-info
multitasking
multitasking-0.0.9.dist-info
murmurhash
murmurhash-1.0.2.dist-info
music21
music21-5.5.0.dist-info
natsort
natsort-5.5.0.dist-info
nbconvert
nbconvert-5.6.1.dist-info
nbformat
nbformat-5.0.3.dist-info
networkx
networkx-2.4.dist-info
nibabel
nibabel-2.3.3.dist-info
nisext
nltk
nltk-3.2.5.dist-info
notebook
notebook-5.2.2.dist-info
np_utils
np_utils-0.5.12.1.dist-info
numba
numba-0.47.0.dist-info
numexpr
numexpr-2.7.1.dist-info
numpy
numpy-1.17.5.dist-info
nvidia_ml_py3-7.352.0.dist-info
nvidia_smi.py
oauth2client
oauth2client-4.1.3.dist-info
oauthlib
oauthlib-3.1.0.dist-info
okgrade
okgrade-0.4.3.dist-info
opencv_contrib_python-4.1.2.30.dist-info
opencv_python-4.1.2.30.dist-info
OpenGL
openpyxl
openpyxl-2.5.9.dist-info
opt_einsum
opt_einsum-3.1.0.dist-info
osqp
osqp-0.6.1.dist-info
osqppurepy
packaging
packaging-20.0.dist-info
palettable
palettable-3.3.0.dist-info
pandas
pandas-0.25.3.dist-info
pandas_datareader
pandas_datareader-0.7.4.dist-info
pandas_gbq
pandas_gbq-0.11.0.dist-info
pandas_profiling
pandas_profiling-1.4.1.dist-info
pandocfilters-1.4.2.dist-info
pandocfilters.py
parso
parso-0.5.2.dist-info
past
pasta
pathlib-1.0.1.dist-info
pathlib.py
patsy
patsy-0.5.1.dist-info
pexpect
pexpect-4.7.0.dist-info
pickleshare-0.7.5.dist-info
pickleshare.py
PIL
Pillow-6.2.2.dist-info
pip
pip-19.3.1.dist-info
piptools
pip_tools-4.2.0.dist-info
pkg_resources
plac-0.9.6.dist-info
plac_core.py
plac_ext.py
plac.py
plac_tk.py
plotly
plotly-4.4.1.dist-info
_plotly_future_
_plotly_utils
plotlywidget
plotnine
plotnine-0.6.0.dist-info
pluggy
pluggy-0.7.1.dist-info
png.py
pngsuite.py
portpicker-1.2.0.dist-info
portpicker.py
prefetch_generator
prefetch_generator-1.0.1.dist-info
preshed
preshed-2.0.1.dist-info
pretty_midi
pretty_midi-0.2.8.dist-info
prettytable-0.7.2.dist-info
prettytable.py
progressbar
progressbar2-3.38.0.dist-info
prometheus_client
prometheus_client-0.7.1.dist-info
promise
promise-2.3.dist-info
prompt_toolkit
prompt_toolkit-1.0.18.dist-info
protobuf-3.10.0.dist-info
protobuf-3.10.0-py3.6-nspkg.pth
psutil
psutil-5.4.8.dist-info
psycopg2
psycopg2-2.7.6.1.dist-info
ptyprocess
ptyprocess-0.6.0.dist-info
pvectorc.cpython-36m-x86_64-linux-gnu.so
py
py-1.8.1.dist-info
pyarrow
pyarrow-0.14.1.dist-info
pyasn1
pyasn1-0.4.8.dist-info
pyasn1_modules
pyasn1_modules-0.2.7.dist-info
__pycache__
pycocotools
pycocotools-2.0.0.dist-info
pycparser
pycparser-2.19.dist-info
pydata_google_auth
pydata_google_auth-0.2.1.dist-info
pydot-1.3.0.dist-info
pydot_ng
pydot_ng-2.0.0.dist-info
pydotplus
pydotplus-2.0.2.dist-info
pydot.py
pydrive
PyDrive-1.3.1.dist-info
pyemd
pyemd-0.5.1.dist-info
pyglet
pyglet-1.3.2.dist-info
pygments
Pygments-2.1.3.dist-info
pylab.py
pymc3
pymc3-3.7.dist-info
pymeeus
PyMeeus-0.3.6.dist-info
pymongo
pymongo-3.10.0.dist-info
pymystem3
pymystem3-0.2.0.dist-info
pynvml.py
PyOpenGL-3.1.5.dist-info
pyparsing-2.4.6.dist-info
pyparsing.py
pypng-0.0.20.dist-info
pyrsistent
pyrsistent-0.15.7.dist-info
_pyrsistent_version.py
pysndfile
pysndfile-1.3.8.dist-info
PySocks-1.7.1.dist-info
pystan
pystan-2.19.1.1.dist-info
_pytest
pytest-3.6.4.dist-info
pytest.py
python_chess-0.23.11.dist-info
python_dateutil-2.6.1.dist-info
python_louvain-0.13.dist-info
python_rtmidi-1.3.1.dist-info
python_slugify-4.0.0.dist-info
python_utils
python_utils-2.3.0.dist-info
pytz
pytz-2018.9.dist-info
PyWavelets-1.1.1.dist-info
pywt
pyximport
PyYAML-3.13.dist-info
pyzmq-17.0.0.dist-info
qtconsole
qtconsole-4.6.0.dist-info
regex
regex-2019.12.20.dist-info
requests
requests-2.21.0.dist-info
requests_oauthlib
requests_oauthlib-1.3.0.dist-info
resampy
resampy-0.2.2.dist-info
retrying-1.3.3.dist-info
retrying.py
rpy2
rpy2-2.9.5.dist-info
rsa
rsa-4.0.dist-info
rtmidi
s3fs
s3fs-0.4.0.dist-info
s3transfer
s3transfer-0.2.1.dist-info
scikit_image-0.16.2.dist-info
scikit_learn-0.22.1.dist-info
scipy
scipy-1.4.1.dist-info
scs
scs-2.1.1.post2.dist-info
_scs_direct.cpython-36m-x86_64-linux-gnu.so
_scs_indirect.cpython-36m-x86_64-linux-gnu.so
_scs_python.cpython-36m-x86_64-linux-gnu.so
seaborn
seaborn-0.9.0.dist-info
semantic_version
semantic_version-2.8.4.dist-info
send2trash
Send2Trash-1.5.0.dist-info
setuptools
setuptools-42.0.2.dist-info
setuptools_git
setuptools_git-1.2.dist-info
shapely
Shapely-1.6.4.post2.dist-info
simplegeneric-0.8.1.dist-info
simplegeneric.py
six-1.12.0.dist-info
six.py
skimage
sklearn
sklearn-0.0.dist-info
sklearn_pandas
sklearn_pandas-1.8.0.dist-info
slugify
smart_open
smart_open-1.9.0.dist-info
snowballstemmer
snowballstemmer-2.0.0.dist-info
sockshandler.py
socks.py
sonnet
sortedcontainers
sortedcontainers-2.1.0.dist-info
spacy
spacy-2.1.9.dist-info
sphinx
Sphinx-1.8.5.dist-info
sphinxcontrib
sphinxcontrib_websupport-1.1.2.dist-info
sphinxcontrib_websupport-1.1.2-py3.7-nspkg.pth
sql
sqlalchemy
SQLAlchemy-1.3.12.dist-info
sqlparse
sqlparse-0.3.0.dist-info
srsly
srsly-1.0.1.dist-info
stable_baselines
stable_baselines-2.2.1.dist-info
statsmodels
statsmodels-0.10.2.dist-info
sympy
sympy-1.1.1.dist-info
tables
tables-3.4.4.dist-info
tabulate-0.8.6.dist-info
tabulate.py
tblib
tblib-1.6.0.dist-info
tensor2tensor
tensor2tensor-1.14.1.dist-info
tensorboard
tensorboard-1.15.0.dist-info
tensorboardcolab
tensorboardcolab-0.0.22.dist-info
tensorflow
tensorflow-1.15.0.dist-info
tensorflow_core
tensorflow_datasets
tensorflow_datasets-1.3.2.dist-info
tensorflow_estimator
tensorflow_estimator-1.15.1.dist-info
tensorflow_gan
tensorflow_gan-2.0.0.dist-info
tensorflow_hub
tensorflow_hub-0.7.0.dist-info
tensorflow_metadata
tensorflow_metadata-0.15.2.dist-info
tensorflow_privacy
tensorflow_privacy-0.2.2.dist-info
tensorflow_probability
tensorflow_probability-0.7.0.dist-info
termcolor-1.1.0.dist-info
termcolor.py
terminado
terminado-0.8.3.dist-info
test
testpath
testpath-0.4.4.dist-info
test_png.py
tests
textblob
textblob-0.15.3.dist-info
textgenrnn
textgenrnn-1.4.1.dist-info
text_unidecode
text_unidecode-1.3.dist-info
tflearn
tflearn-0.3.2.dist-info
theano
Theano-1.0.4.dist-info
thinc
thinc-7.0.8.dist-info
tlz
toolz
toolz-0.10.0.dist-info
torch
torch-1.3.1.dist-info
torchsummary
torchsummary-1.5.1.dist-info
torchtext
torchtext-0.3.1.dist-info
torchvision
torchvision-0.4.2.dist-info
tornado
tornado-4.5.3.dist-info
tqdm
tqdm-4.28.1.dist-info
traitlets
traitlets-4.3.3.dist-info
tweepy
tweepy-3.6.0.dist-info
typing-3.6.6.dist-info
typing_extensions-3.6.6.dist-info
typing_extensions.py
typing.py
tzlocal
tzlocal-1.5.1.dist-info
umap
umap_learn-0.3.10.dist-info
uritemplate
uritemplate-3.0.1.dist-info
urllib3
urllib3-1.24.3.dist-info
vega_datasets
vega_datasets-0.8.0.dist-info
vis
wasabi
wasabi-0.6.0.dist-info
wcwidth
wcwidth-0.1.8.dist-info
webencodings
webencodings-0.5.1.dist-info
werkzeug
Werkzeug-0.16.0.dist-info
wheel
wheel-0.33.6.dist-info
widgetsnbextension
widgetsnbextension-3.5.1.dist-info
wordcloud
wordcloud-1.5.0.dist-info
wrapt
wrapt-1.11.2.dist-info
xarray
xarray-0.14.1.dist-info
xgboost
xgboost-0.90.dist-info
xlrd
xlrd-1.1.0.dist-info
xlwt
xlwt-1.3.0.dist-info
yaml
yellowbrick
yellowbrick-0.9.1.dist-info
zict
zict-1.0.0.dist-info
zipp-0.6.0.dist-info
zipp.py
zmq
zmq-0.0.0.dist-info

Colab comes pre-configured with many packages. (Oddly though, not conda.) This proves to be a real convenience for running random notebooks without lengthy installs. On the otherhand, pretty much anything can be installed via pip, conda, etc. But a long install really kills the enjoyment flow.

pip freeze will list the pre-installed Python packages:

!pip freeze
absl-py==0.9.0
alabaster==0.7.12
albumentations==0.1.12
altair==4.0.0
asgiref==3.2.3
astor==0.8.1
astropy==4.0
atari-py==0.2.6
atomicwrites==1.3.0
attrs==19.3.0
audioread==2.1.8
autograd==1.3
Babel==2.8.0
backcall==0.1.0
backports.tempfile==1.0
backports.weakref==1.0.post1
beautifulsoup4==4.6.3
bleach==3.1.0
blis==0.2.4
bokeh==1.4.0
boto==2.49.0
boto3==1.10.47
botocore==1.13.47
Bottleneck==1.3.1
branca==0.3.1
bs4==0.0.1
bz2file==0.98
cachetools==4.0.0
certifi==2019.11.28
cffi==1.13.2
chainer==6.5.0
chardet==3.0.4
chart-studio==1.0.0
Click==7.0
cloudpickle==1.2.2
cmake==3.12.0
colorlover==0.3.0
community==1.0.0b1
contextlib2==0.5.5
convertdate==2.2.0
coverage==3.7.1
coveralls==0.5
crcmod==1.7
cufflinks==0.17.0
cupy-cuda101==6.5.0
cvxopt==1.2.3
cvxpy==1.0.25
cycler==0.10.0
cymem==2.0.3
Cython==0.29.14
daft==0.0.4
dask==2.9.1
dataclasses==0.7
datascience==0.10.6
decorator==4.4.1
defusedxml==0.6.0
descartes==1.1.0
dill==0.3.1.1
distributed==1.25.3
Django==3.0.2
dlib==19.18.0
dm-sonnet==1.35
dm-tree==0.1.1
docopt==0.6.2
docutils==0.15.2
dopamine-rl==1.0.5
earthengine-api==0.1.209
easydict==1.9
ecos==2.0.7.post1
editdistance==0.5.3
en-core-web-sm==2.1.0
entrypoints==0.3
et-xmlfile==1.0.1
fa2==0.3.5
fancyimpute==0.4.3
fastai==1.0.60
fastcache==1.1.0
fastdtw==0.3.4
fastprogress==0.2.2
fastrlock==0.4
fbprophet==0.5
feather-format==0.4.0
featuretools==0.4.1
filelock==3.0.12
fix-yahoo-finance==0.0.22
Flask==1.1.1
folium==0.8.3
fsspec==0.6.2
future==0.16.0
gast==0.2.2
GDAL==2.2.2
gdown==3.6.4
gensim==3.6.0
geographiclib==1.50
geopy==1.17.0
gevent==1.4.0
gin-config==0.3.0
glob2==0.7
google==2.0.3
google-api-core==1.15.0
google-api-python-client==1.7.11
google-auth==1.10.0
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.4.1
google-cloud-bigquery==1.21.0
google-cloud-core==1.0.3
google-cloud-datastore==1.8.0
google-cloud-language==1.2.0
google-cloud-storage==1.16.2
google-cloud-translate==1.5.0
google-colab==1.0.0
google-pasta==0.1.8
google-resumable-media==0.4.1
googleapis-common-protos==1.6.0
googledrivedownloader==0.4
GPUtil==1.4.0
graph-nets==1.0.5
graphviz==0.10.1
greenlet==0.4.15
grpcio==1.26.0
gspread==3.0.1
gspread-dataframe==3.0.3
gunicorn==20.0.4
gym==0.15.4
h5py==2.10.0
HeapDict==1.0.1
holidays==0.9.12
html5lib==1.0.1
httpimport==0.5.18
httplib2==0.11.3
humanize==0.5.1
hyperopt==0.1.2
ideep4py==2.0.0.post3
idna==2.8
image==1.5.27
imageio==2.4.1
imagesize==1.2.0
imbalanced-learn==0.4.3
imblearn==0.0
imgaug==0.2.9
importlib-metadata==1.4.0
imutils==0.5.3
inflect==2.1.0
intel-openmp==2020.0.133
intervaltree==2.1.0
ipykernel==4.6.1
ipython==5.5.0
ipython-genutils==0.2.0
ipython-sql==0.3.9
ipywidgets==7.5.1
itsdangerous==1.1.0
jax==0.1.52
jaxlib==0.1.36
jdcal==1.4.1
jedi==0.15.2
jieba==0.40
Jinja2==2.10.3
jmespath==0.9.4
joblib==0.14.1
jpeg4py==0.1.4
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.3.4
jupyter-console==5.2.0
jupyter-core==4.6.1
kaggle==1.5.6
kapre==0.1.3.1
Keras==2.2.5
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
keras-vis==0.4.1
kfac==0.2.0
kiwisolver==1.1.0
knnimpute==0.1.0
librosa==0.6.3
lightgbm==2.2.3
llvmlite==0.31.0
lmdb==0.98
lucid==0.3.8
lunardate==0.2.0
lxml==4.2.6
magenta==0.3.19
Markdown==3.1.1
MarkupSafe==1.1.1
matplotlib==3.1.2
matplotlib-venn==0.11.5
mesh-tensorflow==0.1.8
mido==1.2.6
mir-eval==0.5
missingno==0.4.2
mistune==0.8.4
mizani==0.6.0
mkl==2019.0
mlxtend==0.14.0
more-itertools==8.0.2
moviepy==0.2.3.5
mpi4py==3.0.3
mpmath==1.1.0
msgpack==0.5.6
multiprocess==0.70.9
multitasking==0.0.9
murmurhash==1.0.2
music21==5.5.0
natsort==5.5.0
nbconvert==5.6.1
nbformat==5.0.3
networkx==2.4
nibabel==2.3.3
nltk==3.2.5
notebook==5.2.2
np-utils==0.5.12.1
numba==0.47.0
numexpr==2.7.1
numpy==1.18.1
nvidia-ml-py3==7.352.0
oauth2client==4.1.3
oauthlib==3.1.0
okgrade==0.4.3
opencv-contrib-python==4.1.2.30
opencv-python==4.1.2.30
openpyxl==2.5.9
opt-einsum==3.1.0
osqp==0.6.1
packaging==20.0
palettable==3.3.0
pandas==0.25.3
pandas-datareader==0.7.4
pandas-gbq==0.11.0
pandas-profiling==1.4.1
pandocfilters==1.4.2
parso==0.5.2
pathlib==1.0.1
patsy==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
Pillow==6.2.2
pip-tools==4.2.0
plac==0.9.6
plotly==4.4.1
plotnine==0.6.0
pluggy==0.7.1
portpicker==1.2.0
prefetch-generator==1.0.1
preshed==2.0.1
pretty-midi==0.2.8
prettytable==0.7.2
progressbar2==3.38.0
prometheus-client==0.7.1
promise==2.3
prompt-toolkit==1.0.18
protobuf==3.11.2
psutil==5.4.8
psycopg2==2.7.6.1
ptyprocess==0.6.0
py==1.8.1
pyarrow==0.14.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycocotools==2.0.0
pycparser==2.19
pydata-google-auth==0.2.1
pydot==1.3.0
pydot-ng==2.0.0
pydotplus==2.0.2
PyDrive==1.3.1
pyemd==0.5.1
pyglet==1.3.2
Pygments==2.1.3
pygobject==3.26.1
pymc3==3.7
PyMeeus==0.3.6
pymongo==3.10.0
pymystem3==0.2.0
PyOpenGL==3.1.5
pyparsing==2.4.6
pypng==0.0.20
pyrsistent==0.15.7
pysndfile==1.3.8
PySocks==1.7.1
pystan==2.19.1.1
pytest==3.6.4
python-apt==1.6.4
python-chess==0.23.11
python-dateutil==2.6.1
python-louvain==0.13
python-rtmidi==1.3.1
python-slugify==4.0.0
python-utils==2.3.0
pytz==2018.9
PyWavelets==1.1.1
PyYAML==3.13
pyzmq==17.0.0
qtconsole==4.6.0
regex==2019.12.20
requests==2.22.0
requests-oauthlib==1.3.0
resampy==0.2.2
retrying==1.3.3
rpy2==2.9.5
rsa==4.0
s3fs==0.4.0
s3transfer==0.2.1
scikit-image==0.16.2
scikit-learn==0.22.1
scipy==1.4.1
screen-resolution-extra==0.0.0
scs==2.1.1.post2
seaborn==0.9.0
semantic-version==2.8.4
Send2Trash==1.5.0
setuptools-git==1.2
Shapely==1.6.4.post2
simplegeneric==0.8.1
six==1.13.0
sklearn==0.0
sklearn-pandas==1.8.0
smart-open==1.9.0
snowballstemmer==2.0.0
sortedcontainers==2.1.0
spacy==2.1.9
Sphinx==1.8.5
sphinxcontrib-websupport==1.1.2
SQLAlchemy==1.3.12
sqlparse==0.3.0
srsly==1.0.1
stable-baselines==2.2.1
statsmodels==0.10.2
sympy==1.1.1
tables==3.4.4
tabulate==0.8.6
tblib==1.6.0
tensor2tensor==1.14.1
tensorboard==2.1.0
tensorboardcolab==0.0.22
tensorflow==2.1.0rc1
tensorflow-addons==0.6.0
tensorflow-datasets==1.3.2
tensorflow-estimator==2.1.0
tensorflow-federated==0.11.0
tensorflow-gan==2.0.0
tensorflow-hub==0.7.0
tensorflow-metadata==0.15.2
tensorflow-model-optimization==0.1.3
tensorflow-privacy==0.2.2
tensorflow-probability==0.7.0
termcolor==1.1.0
terminado==0.8.3
testpath==0.4.4
text-unidecode==1.3
textblob==0.15.3
textgenrnn==1.4.1
tflearn==0.3.2
Theano==1.0.4
thinc==7.0.8
toolz==0.10.0
torch==1.3.1
torchsummary==1.5.1
torchtext==0.3.1
torchvision==0.4.2
tornado==4.5.3
tqdm==4.28.1
traitlets==4.3.3
tweepy==3.6.0
typing==3.6.6
typing-extensions==3.6.6
tzlocal==1.5.1
umap-learn==0.3.10
uritemplate==3.0.1
urllib3==1.25.7
vega-datasets==0.8.0
wasabi==0.6.0
wcwidth==0.1.8
webencodings==0.5.1
Werkzeug==0.16.0
widgetsnbextension==3.5.1
wordcloud==1.5.0
wrapt==1.11.2
xarray==0.14.1
xgboost==0.90
xkit==0.0.0
xlrd==1.1.0
xlwt==1.3.0
yellowbrick==0.9.1
zict==1.0.0
zipp==0.6.0
zmq==0.0.0

Jupyter

Colab is just Jupyter, tweaked out for Google's front-end style (e.g., collaborative editing).

!jupyter-kernelspec list
/tensorflow-2.1.0/python3.6/pkg_resources/py2_warn.py:19: UserWarning: ************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release. Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please comment in
https://github.com/pypa/setuptools/issues/1458
about the steps that led to this unsupported combination.
************************************************************
  sys.version_info < (3,) and warnings.warn("*" * 60 + msg + "*" * 60)
Available kernels:
  ir         /usr/local/share/jupyter/kernels/ir
  python2    /usr/local/share/jupyter/kernels/python2
  python3    /usr/local/share/jupyter/kernels/python3
  swift      /usr/local/share/jupyter/kernels/swift

CPU

How many CPUs does this machine have?

!lscpu | grep "^CPU(s):"
CPU(s):              2

More details on the CPU(s):

!cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 85
model name	: Intel(R) Xeon(R) CPU @ 2.00GHz
stepping	: 3
microcode	: 0x1
cpu MHz		: 2000.168
cache size	: 39424 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat md_clear arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4000.33
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 85
model name	: Intel(R) Xeon(R) CPU @ 2.00GHz
stepping	: 3
microcode	: 0x1
cpu MHz		: 2000.168
cache size	: 39424 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat md_clear arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4000.33
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:

RAM

!cat /proc/meminfo | head -n3
MemTotal:       13335180 kB
MemFree:        10579780 kB
MemAvailable:   12456712 kB

RAM info humanized:

process = psutil.Process(os.getpid())
print("RAM Free: " + humanize.naturalsize( psutil.virtual_memory().available ), " | Proc size: " + humanize.naturalsize( process.memory_info().rss))
RAM Free: 12.8 GB  | Proc size: 157.1 MB

File system

As with AWS Lambda, there are intentionally few switches for selecting VM options. Memory and CPU are provided as matching packages, not independently configurable.

So, depending on what you ask for in terms of compute (CPU, GPU, TPU) you get more or less file system memory [*]. Note: for all compute options, the OS files initialize to consuming about 25MB of the file system before you are dropped into the kernel.

On 2019-05-19, the following tests gave these results:

Processor FS Free GB FS Total GB
CPU 24 49
GPU 318 359
TPU 26 49

The low FS size for the TPU is probably because for the TPU case, those (the actually TPU boards) are separate machines while for GPUs those are a part of the machine the notebook is running on. So, for the CPU and the TPU options, Google is probably providing the same VM, ergo the file systems are essentially the same size.

!df -h .
Filesystem      Size  Used Avail Use% Mounted on
overlay          69G   32G   34G  49% /

GPU information

First, is a GPU allocated for this notebook's VM to work with?

Google's GPU docs

What GPU is currently config'd for use?

import tensorflow as tf
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
  print("GPU detected: NONE")
else:
  print('GPU detected: {}'.format(device_name))
GPU detected: /device:GPU:0

Assuming we have a GPU, what kind? The answer is in the final line of the following cell's output:

from tensorflow.python.client import device_lib
device_lib.list_local_devices()
[name: "/device:CPU:0"
 device_type: "CPU"
 memory_limit: 268435456
 locality {
 }
 incarnation: 2310594102151097800, name: "/device:XLA_CPU:0"
 device_type: "XLA_CPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 17535441911990928449
 physical_device_desc: "device: XLA_CPU device", name: "/device:XLA_GPU:0"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 10225456670585236756
 physical_device_desc: "device: XLA_GPU device", name: "/device:GPU:0"
 device_type: "GPU"
 memory_limit: 14912199066
 locality {
   bus_id: 1
   links {
   }
 }
 incarnation: 13359578449152668052
 physical_device_desc: "device: 0, name: Tesla T4, pci bus id: 0000:00:04.0, compute capability: 7.5"]

GPU memory

!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi

import GPUtil as GPU

gpus = GPU.getGPUs()

if len(gpus) > 0:
  gpu = gpus[0]
  print("GPU RAM:\n Free: {0:.0f}MB | Used: {1:.0f}MB | Util {2:3.0f}% | Total {3:.0f}MB".format(gpu.memoryFree, gpu.memoryUsed, gpu.memoryUtil*100, gpu.memoryTotal))
else:
  print("GPU detected: NONE")
GPU RAM:
 Free: 14968MB | Used: 111MB | Util   1% | Total 15079MB
!nvcc --version
!conda install tsnecuda cuda100 -c cannylab
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130
/bin/bash: conda: command not found