Using Google Colab - Rapid Intro
Overview
Google Colab is a free, cloud-based environment for running Python notebooks.
You can use it from any computer without installing Python locally. It is especially helpful if:
- Your computer cannot install packages reliably
- You are troubleshooting your Python installation
- You want quick access to a working Python environment
This guide explains how to open Colab, upload or access notebooks, install packages, work with files, and download your work.
1. What Is Google Colab?
Google Colab provides:
- A hosted Python runtime (no setup required)
- Built-in Jupyter-like notebook interface
- Free GPU/TPU access
- Integration with Google Drive
Colab notebooks use the .ipynb format, but you can also copy/paste Python code from .py files.
2. Opening Google Colab
Go to:
https://colab.research.google.com/
You will see a window prompting you to:
- Start a new notebook
- Upload a
.ipynbfile
- Open from Google Drive
- Open from GitHub
3. Option A — Create a New Notebook
- Go to File → New Notebook.
- A new notebook will open with a default Python environment.
- You can copy/paste code from the textbook or
.pyfiles.
Use Shift + Enter to run a cell.
4. Option B — Upload a Notebook from Your Computer
- Go to File → Upload Notebook
- Select the notebook you downloaded
- Colab will open it in a new tab
5. Option C — Open a Notebook Directly from GitHub
- Go to File → Open Notebook
- Choose the GitHub tab
- Paste the repository URL
- Select the notebook you want to open
Example:
https://github.com/<your-username>/undergrad-ai-text
6. Installing Packages in Colab
Colab comes with many Python packages preinstalled.
To install additional packages:
!pip install seabornOr install from a requirements file:
!pip install -r requirements.txt7. Working with Files
Temporary Upload
from google.colab import files
uploaded = files.upload()Mount Google Drive
from google.colab import drive
drive.mount('/content/drive')Your Drive will appear at:
/content/drive/MyDrive/
8. Saving Your Work
Save to Drive
File → Save a copy in Drive
Download
File → Download → .ipynb
File → Download → .py
9. Limitations of Colab
- Sessions time out
- Temporary files are deleted
- Packages must be reinstalled each session
- Internet connection required
10. Summary
Google Colab allows you to:
- Run Python without installing anything
- Upload/open notebooks
- Install packages
- Work with Drive
- Download your work
It is a useful fallback or complementary environment for this text.