• Home
  • About
    • Alessandro Pagiaro photo

      Alessandro Pagiaro

      FullStack Software Engineer @ Domotz (Pisa, Italy).

    • Learn More
    • Email
    • Twitter
    • LinkedIn
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

A cloud alternative to Jupyter from Google

11 Oct 2018

Reading time ~2 minutes

In our course of Data Mining, at the University of Pisa, the teacher uses Jupyter. Jupyter is a notebook where you can write some code, execute it and then see the output directly below the code, in the same page. It is a very powerful tool that speeds up the coding phase and helps people that are not familiar with the terminal to code in a “familiar” space. Google Colab

The main problem is that Jupyter is complex to configure, to change from Python 2.7 to 3 you have to install packets, do stuff with the terminal, download bytes on your disk and so on… Moreover, if you would like to share the notebook with your colleague you have to do some special trick: install jupyter on your server, activate multiuser mode, invest hours of your time because it will not works…

But there is a solution: Google CoLab

It is like a Jupyter, more minimal but has:

  1. Python 2.7 and 3 are available and both are ready to use
  2. You can share it like any other Google Docs file, simply generating a link and send it
  3. It is in the cloud, you can use it anywhere
  4. It supports hardware acceleration
  5. It can execute python on your machine or on hosted one
  6. It can access your Google Drive account with few lines of code

Python 2.7 or 3

You can simply change the runtime type selecting “Runtime” from the main menu, then “Change runtime type”. No other installations are required! Google Colab

Share the notebook

You should be familiar with this feature Google Colab

Execute on your machine

Here some more configurations have to be done. If you would like to execute code on your machine you have to install Jupyter, then have to activate the jupyter_http_over_ws jupyter extension then start the server. https://research.google.com/colaboratory/local-runtimes.html. Google Colab

Access to file

In order access to some files you can:

  • Connect to Google Drive
from google.colab import drive
drive.mount('/content/drive')
  • Upload files on the temporary local drive
  • Download the file from a Gist
import requests
url="https://gist.githubusercontent.com/..../file.txt"
s=requests.get(url).content
df=pd.read_csv(io.StringIO(s.decode('utf-8')))

Google Colab

Try it!



pythongoogleJupyter Share Tweet +1