Article
Jupyter vs VS Code vs Colab: where should you learn machine learning?
Free GPUs, offline work, real debugging — each tool wins somewhere. An honest comparison plus the setup that gets you the benefits of all three.
On this page0%
- The comparison
- Colab — start in ten seconds
- Jupyter — notebooks on your own machine
- VS Code — where projects grow up
- Choosing
- Notebook habits worth having
- FAQ
- Should I use Colab or Jupyter for machine learning?
- Is VS Code better than Jupyter Notebook?
- Why does Colab disconnect and lose my variables?
- How do I fix a Jupyter kernel using the wrong Python?
- Is it safe to upload private data to Colab?
- Next reading on Sythra Articles
Three tools, three different jobs. Beginners usually pick one and stick with it forever, which means fighting the tool half the time.
Short answer: Colab to start today with a free GPU, VS Code once your code outgrows one file, Jupyter locally when you want notebooks on your own machine and your own data.
The comparison
| Colab | Jupyter | VS Code | |
|---|---|---|---|
| Setup | None — open a browser | Install locally | Install locally |
| Free GPU | Yes | No | No |
| Works offline | No | Yes | Yes |
| Debugger | Weak | Weak | Excellent |
| Multi-file projects | Awkward | Awkward | Excellent |
| Git integration | Poor | Poor | Built in |
| Autocomplete | Basic | Basic | Excellent |
| Session limits | Disconnects when idle | None | None |
| Private data | Uploads to Google | Stays local | Stays local |
| Cost | Free tier | Free | Free |
Colab — start in ten seconds
Open colab.research.google.com, create a notebook, and run:
import torch
print(torch.cuda.is_available())
Enable the GPU first: Runtime → Change runtime type → T4 GPU. That is a real GPU, free, with no installation.
Most ML packages are preinstalled. Add anything missing inside a cell:
!pip install -q transformers datasets
Mount your Drive so files survive the session ending:
from google.colab import drive
drive.mount("/content/drive")
import pandas as pd
df = pd.read_csv("/content/drive/MyDrive/data/sales.csv")
Colab is best for: your first weeks of ML, anything needing a GPU, and sharing a runnable notebook with someone else.
Real limitations:
- Idle sessions disconnect and you lose all variables — save checkpoints
- The free GPU is not always available at busy times
- Your data goes to Google's servers; check before uploading anything confidential
- Managing more than a couple of files is painful
Jupyter — notebooks on your own machine
python -m venv .venv
.venv\Scripts\Activate.ps1 # or source .venv/bin/activate
python -m pip install jupyterlab pandas scikit-learn matplotlib
jupyter lab
It opens in your browser at localhost:8888. Same notebook interface as Colab, your own hardware, your own files, no upload and no time limit.
The one thing that trips everyone up is kernels. A notebook runs a specific Python, which may not be the one you installed into:
import sys
print(sys.executable)
If that path is not your project's environment, register it properly:
python -m pip install ipykernel
python -m ipykernel install --user --name myproject --display-name "Python (myproject)"
Then pick Python (myproject) from the kernel menu. This is the fix for most "but I installed it!" moments in notebooks — the same underlying cause as No module named 'cv2'.
Jupyter is best for: exploring data locally, sensitive datasets, and long-running jobs that must not be interrupted.
VS Code — where projects grow up
# Install VS Code, then the Python and Jupyter extensions
VS Code runs .ipynb notebooks natively, so you do not give anything up — you gain:
- A real debugger with breakpoints and variable inspection
- Go to definition on any function, including library code
- Git built in: diffs, branches, commits
- Multi-file projects that stay organised
Select the interpreter with Ctrl+Shift+P → Python: Select Interpreter and choose your project's environment.
The killer feature for learning is the debugger. In a notebook you debug by adding print statements. In VS Code you set a breakpoint, run, and inspect every variable at the moment things went wrong. That difference compounds enormously once your code is longer than a screen.
A hybrid habit works well: keep exploration in notebooks, and move anything reused into a .py file:
# features.py
def clean_prices(df):
df["price"] = pd.to_numeric(df["price"], errors="coerce")
return df.dropna(subset=["price"])
# notebook cell
%load_ext autoreload
%autoreload 2
from features import clean_prices
df = clean_prices(df)
autoreload picks up edits to features.py without restarting the kernel. This is how experienced people use notebooks: as a scratchpad in front of real modules, not as the codebase itself.
VS Code is best for: anything you will run more than a few times, team projects, and learning to debug properly.
Choosing
| Situation | Use |
|---|---|
| First ML tutorial today | Colab |
| Need a GPU, own none | Colab |
| Confidential data | Jupyter or VS Code |
| Exploring a new dataset | Jupyter or VS Code notebooks |
| Project spans several files | VS Code |
| Chasing a bug | VS Code |
| Sharing a runnable demo | Colab |
| Working on a train with no wifi | Jupyter or VS Code |
Notebook habits worth having
Restart and run all before you trust a result. Cells run in whatever order you clicked them. A notebook that only works in the order you happened to use is not reproducible — and this catches out more people than any other habit on this list.
Never leave secrets in a cell. Use environment variables:
import os
api_key = os.environ["ANTHROPIC_API_KEY"]
Clear outputs before committing. Notebook diffs are unreadable otherwise:
python -m pip install nbstripout
nbstripout --install
Checkpoint long training runs, especially on Colab where a disconnect wipes everything:
import joblib
joblib.dump(model, "/content/drive/MyDrive/checkpoints/model.joblib")
FAQ
Should I use Colab or Jupyter for machine learning?
Use Colab when you need a free GPU or want to start without installing anything. Use Jupyter locally when your data is private, you work offline, or long jobs must not be interrupted by a session timeout.
Is VS Code better than Jupyter Notebook?
For projects, yes — it gives you a real debugger, git integration and multi-file navigation while still running notebooks. For quick data exploration, plain Jupyter is lighter.
Why does Colab disconnect and lose my variables?
Free Colab sessions end after a period of inactivity or after several hours. Save models and intermediate data to Google Drive so a disconnect costs you time rather than work.
How do I fix a Jupyter kernel using the wrong Python?
Print sys.executable in a cell to see which interpreter is running, then register the correct environment with python -m ipykernel install --user --name myproject and select it from the kernel menu.
Is it safe to upload private data to Colab?
Data uploaded to Colab is stored on Google's servers. For confidential or regulated data, run Jupyter or VS Code locally instead.