Setting up a Python Jupyter Notebook Online & Working with Python on the Cloud
Hello friends, today we will discuss on how we can work with Python without installing or doing any setup on our local machines or workstations. This will avoid the struggle to set-up the environment, if you have not done this before or if you are working on a computer that can’t handle the workload
In today’s world, the solution is the Cloud. There are 2 (as of my information, if you come across any new ones please let know, and I will be grateful to you) free Jupyter notebook environments where you can use free GPUs and TPUs which can solve these issues.
- Google Colaboratory
- Jupyter Notebook by CoCalc by SageMath, Inc
Let’s see how we can setup and start work within few minutes, hassle free.
Getting Started with Google Colaboratory
Please note that there are various ways to connect to Google Colaboratory.
Approach 1 →
To start working with Colab you first need to login to your google account, then go to this link https://colab.research.google.com which will open the page as shown below. And then you are all set to start.
Let’s understand what it offers. On opening the website, you will see a pop-up containing following tabs

EXAMPLES: Contains several Jupyter notebooks of various types.
RECENT: Jupyter notebooks you have recently worked with.
GOOGLE DRIVE: The Jupyter notebook in your google drive. I will be covering this in approach 2.
GITHUB: You can add Jupyter notebooks from your GitHub, but you first need to connect Colab with GitHub.
UPLOAD: Upload from your local directory.
You can create a new Jupyter notebook by clicking NEW NOTEBOOK at the bottom right corner. Or CANCEL if you do not wish to continue.

Approach 2 →
If you already have Google Drive, then you can directly go to Google Colab. Connect to your Google Drive account, and you will land on the page shown below and you are all set to start.
Let’s see what it offers.

From here we must use the navigation to open Google Colaboratory, as shown below.

On creating a new notebook, it will create a Jupyter notebook with Untitled0.ipynb (red encircled and marked as 1 see screenshot belwo) and save it to your google drive in a folder named Colab Notebooks. Now as it is essentially a Jupyter notebook, all commands of Jupyter notebooks will work here. Though, you can refer to the details in Getting started with Jupyter Notebooks.

Let’s talk about other options, from the above screenshot, check the red marked number 2, which is a working cell. This is to write Python code; be it for Machine Learning or any general Python Programming hands-on. An example is shown below.
This cell can also be converted from Python executable cell to markdown or plain text cell. This can be done either by using + Text as marked 3 in red

In Text we do have options to make the text bold, enclose the syntax as a code using < >, and so on.

To save the file, google provided options such as “Save a Copy in Drive”; “Save a copy as GitHub Gist”; “Save a copy in GitHub”. This can be done via navigating to File.

Another awesome option is moving the cell (be it executable code cell or text / markdown cell) up or down using the up arrow or down arrow.

- Can Delete the Cell.
- Link to Cell.
- Add comments for a cell.
- Copy Cell
- Cut Cell
- Edit Cell
Change Runtime Environment:
Click the “Runtime” dropdown menu. Select “Change runtime type”.
Another window will pop-up, from which you can select Python Version.

Select Python 2 or Python 3 from “Runtime type” dropdown menu.

Use GPU and TPU:
In a similar way to the above, or even as a continuations to the above, we can change the “Hardware accelerator” and set it to GPU or TPU based on your requirements.
Click the “Runtime” dropdown menu. Select “Change runtime type”. Now select anything (GPU, CPU, None) you want in the “Hardware accelerator” dropdown menu.

Download Jupyter Notebook:
Let’s say you want to download your working file. Click “File” dropdown menu at top left corner. Choose “download .ipynb” or “download .py”

Share Jupyter Notebook:
You can share your notebook by adding email addresses or by creating a shareable link. As red encircled.

Jupyter Notebook by CoCalc by SageMath, Inc
To start working with a Jupyter Notebook click on the link https://cocalc.com/doc/jupyter-notebook.html and it will ask you to Sign In.
Please do sign-in either create a new account or sign-in using your social network.

After sign-in, it will ask you to create a Projects file, this is to manage all your .py and data-set files.
Just give a name to your Project, for example I have used First Hands-On. You can have your own.

After that it will ask you to create or upload a file. For now, we will start with creating a new file, make sure to select “Select the type of file” as “Jupyter Notebook”.



And you are all set. We can start working with Machine Learning; Data Analysis or simple hands-on with Python.

Let’s understand what it offers.
Locate the file → Once created the file(s), we can list of files as below by clicking on Files.

Similar to Google Colab, Jupyter Notebook by Cocalc.com also provide Executable Cell / Plain Text (Markdown) / Raw. Refer red encircled. Also this is exactly same to what we do have on original Jupyter Notebook which we install on local machine.

Have options to Save, Copy, Cut, zoom in, Zoom Out, Print etc…

Once can also run or execute the cell in different ways as mentioned or red encircled.
- Run cells → To run the selected cell..
- Run cells and select below → To run the selected cell and either a new cell after running or if cell already available pointer will select to that cell.
- Run cells and insert cell below → To run To run the selected cell and to create a new cell below after running.
- Run all → Will run all the cells from top to bottom.
- Run all above → Will run all the cell which are above of selected cell.
- Run all below → Will run all the cell which are below of selected cell.

Similar to Google Colab, here too we have options to move the cell down or up using down arrow or up arrow respectively.

Cool… so we are all set with the Jupyter Notebook, and from next article will start directly jump into practical things and will have our hands dirty.
Please add comments if you face any issue in any of the step, will be happy to help.
If you found this Article interesting, why not review the other Articles in our archive.
Comments:

Balakrishnan Subramanian
10 Apr 2020 02:26:16 PM

Abhishek Mishra
19 Apr 2020 06:26:25 PM
Ekta Tripathi
06 Apr 2020 06:08:02 PM