You now have the conceptual foundations of deep learning; time to set up the workshop. In this lesson you will build the environment where you will run all the code in the course: we will look at the two main options — Google Colab (recommended to start, with a free GPU) and a local installation with Python — you will learn the basics of Jupyter Notebooks, verify that the installation and the GPU work with a concrete script, and create the TecnoMarket project folder structure we will use for the rest of the course. An environment set up properly from the start will save you hours of frustration: most beginners' problems are not about neural networks, but about installation.

Contents

  1. The two options: Colab vs local installation
  2. Option A: Google Colab, step by step
  3. Option B: local installation with Python
  4. Jupyter Notebooks: the basics
  5. Environment and GPU verification script
  6. TecnoMarket project folder structure
  7. Best practices: isolated environments and versions

The two options: Colab vs local installation

To train neural networks you need Python, a handful of libraries and, if possible, a GPU (remember from lesson 01-02: GPUs were one of the keys to the resurgence of deep learning; they speed up training 10 to 50 times). There are two ways to get all this:

Aspect Google Colab (cloud) Local installation
Initial cost Free Free (but an NVIDIA GPU costs money)
GPU Included for free (with usage limits) Only if your machine has one
Installation None: it opens in the browser Python + libraries + (GPU drivers)
Requires internet Yes, always No
Persistence Sessions get reset; you must save to Google Drive Everything stays on your disk
Data privacy Your data goes up to Google Your data never leaves your machine
Ideal for Learning, prototyping, this course Ongoing work, sensitive data, serious projects

Recommendation for the course: start with Google Colab. Zero installation, a free GPU, and all the course notebooks will work as-is. Set up the local environment in addition (not instead) whenever you want: it is the realistic scenario of a real job, and at TecnoMarket, with internal customer and payment data, the team would work locally or on their own servers precisely for privacy reasons.

Option A: Google Colab, step by step

Google Colab (colab.research.google.com) is a free service that runs Python notebooks on Google's servers.

  1. Sign in at https://colab.research.google.com with a Google account.
  2. Create a notebook: menu File → New notebook. You can already run Python: there is nothing to install, the main libraries (TensorFlow, PyTorch, NumPy, pandas, matplotlib) come preinstalled.
  3. Enable the GPU: menu Runtime → Change runtime type → Hardware accelerator: GPU → Save. This step is easy to forget and is the number-one cause of "my training is incredibly slow" on Colab.
  4. Run your first cell: type the code and press Shift+Enter.
# First cell in Colab: check that Python is there and which GPU we got
import sys
print("Python version:", sys.version)

# System command (the ! sign runs terminal commands from the notebook)
!nvidia-smi

If you enabled the GPU, nvidia-smi will show a table with the model of the assigned card (a T4, for example) and its memory. If it errors out, go back and check step 3.

Limitations to know about: free sessions disconnect after a period of inactivity (and have a maximum number of hours), and the session disk is wiped on disconnect. Always save your notebooks (they save themselves to Google Drive) and mount Drive to keep data and models:

# Mount Google Drive to store data and models persistently
from google.colab import drive
drive.mount('/content/drive')
# From here on, anything saved in /content/drive/MyDrive/ survives the session

Option B: local installation with Python

To work on your own machine you need four steps: Python, an isolated environment, the libraries and Jupyter.

Step 1: install Python 3

You need Python 3.10 or higher (check the version with python3 --version).

  • Linux: usually comes preinstalled. If not: sudo apt install python3 python3-pip python3-venv (Debian/Ubuntu).
  • Windows: download the installer from https://www.python.org/downloads/ and check the "Add Python to PATH" box during installation.
  • macOS: brew install python3 (with Homebrew) or the installer from python.org.

Step 2: create an isolated environment

Never install libraries directly onto the system Python. An isolated environment is a folder with its own copy of Python and its own libraries; if something breaks, you delete the folder and start over without affecting anything else. There are two equivalent tools; use one or the other:

With venv (included with Python):

# Create the project folder and the environment
mkdir tecnomarket-dl
cd tecnomarket-dl
python3 -m venv .venv

# Activate the environment (you must do this in every terminal session)
source .venv/bin/activate        # Linux / macOS
# .venv\Scripts\activate         # Windows (PowerShell or CMD)

# You will see (.venv) at the start of the prompt: the environment is active

With conda (if you prefer the Miniconda/Anaconda distribution):

conda create -n tecnomarket-dl python=3.11
conda activate tecnomarket-dl

Step 3: install the libraries

With the environment activated:

# Upgrade pip (Python's package manager)
pip install --upgrade pip

# Deep learning frameworks: we install the two the course uses
pip install tensorflow torch torchvision

# Supporting tools
pip install numpy pandas matplotlib scikit-learn jupyter

What each one is:

  • tensorflow: Google's deep learning framework; we will use it through its Keras API (module 6, lesson 06-01).
  • torch / torchvision: PyTorch, Meta's framework, and its vision utilities (lesson 06-02). We install both frameworks because the course teaches both; the in-depth comparison comes in lesson 06-03.
  • numpy / pandas: numerical computing and handling of data tables.
  • matplotlib: plotting (training curves, image visualization).
  • scikit-learn: classical ML utilities (train/test splits, metrics).
  • jupyter: notebooks running locally.

A note on local GPUs: on Windows/Linux, PyTorch and TensorFlow only accelerate with an NVIDIA GPU (via CUDA); the standard installation above runs on CPU on any machine, which is enough for the course's small examples. If you have an NVIDIA GPU and want to use it, follow each framework's official installation guide for your system (driver/CUDA combinations change often, so it is best to check the official pages: pytorch.org/get-started and tensorflow.org/install). If you don't have a GPU, don't worry: that is what Colab is for.

Step 4: launch Jupyter

jupyter notebook
# Your browser will open at http://localhost:8888 showing your folders

Jupyter Notebooks: the basics

Both Colab and local Jupyter share the same concept: the notebook, an interactive document mixing executable code cells with text cells (Markdown). It is the standard format for experimenting in deep learning because it lets you run your work step by step, see results (tables, plots) next to the code, and document what you do.

The bare minimum you should know:

Action How
Run a cell Shift+Enter (runs it and moves to the next one)
Insert cell below Key B (with the cell selected, not while editing it)
Insert cell above Key A
Delete cell D, D (twice)
Convert cell to text/Markdown Key M (and Y to switch back to code)
Restart the kernel Menu Kernel → Restart (clears all variables)

Two important concepts:

  • The kernel is the Python process that runs your cells. Variables persist across cells as long as the kernel lives.
  • Execution order matters: you can run cells in any order, and that is a classic source of errors (using a variable defined in a cell you have not run yet, or "ghost" results from earlier runs). Faced with strange behavior, the universal remedy is Kernel → Restart & Run All: it restarts and runs everything top to bottom. If it works that way, your notebook is reproducible.

Environment and GPU verification script

Create a notebook (in Colab or locally) called 00_verification.ipynb and run this complete script. It is the environment's "medical checkup": it verifies versions, frameworks and the GPU.

# === TecnoMarket-DL environment verification script ===
import sys
print(f"Python: {sys.version.split()[0]}")

# --- Data libraries ---
import numpy as np
import pandas as pd
import matplotlib
print(f"NumPy: {np.__version__} | pandas: {pd.__version__} | matplotlib: {matplotlib.__version__}")

# --- TensorFlow ---
import tensorflow as tf
print(f"\nTensorFlow: {tf.__version__}")
gpus_tf = tf.config.list_physical_devices('GPU')
print(f"GPU visible to TensorFlow: {'YES -> ' + str(gpus_tf) if gpus_tf else 'NO (will use CPU)'}")

# --- PyTorch ---
import torch
print(f"\nPyTorch: {torch.__version__}")
if torch.cuda.is_available():
    print(f"GPU visible to PyTorch: YES -> {torch.cuda.get_device_name(0)}")
else:
    print("GPU visible to PyTorch: NO (will use CPU)")

# --- Mini real-computation test ---
# We multiply two large matrices: if this works, the environment is operational
a = torch.rand(1000, 1000)   # 1000x1000 matrix of random numbers
b = torch.rand(1000, 1000)
device = "cuda" if torch.cuda.is_available() else "cpu"
result = (a.to(device) @ b.to(device))   # @ = matrix multiplication
print(f"\n1000x1000 matrix multiplication on '{device}': OK, sum = {result.sum():.2f}")

print("\n=== Environment verified: ready for the course ===")

Interpreting the output:

  • The versions of all the libraries should appear without any ImportError. If one fails, check that the environment is activated and reinstall it with pip.
  • The GPU lines will say YES or NO. On Colab with the GPU enabled they must say YES; on a laptop without NVIDIA they will say NO, and that is normal: the course can be followed on CPU (the examples are sized for it) and you can use Colab for the heavy training runs.
  • The mini test runs a real operation of the kind neural networks perform (matrix multiplication — exactly the inputs × weights from lesson 01-04, at scale). If it prints OK, everything truly works, not just imports.

TecnoMarket project folder structure

Over the course we will be generating notebooks, data and models for the TecnoMarket project. Creating a tidy structure now will prevent chaos later. Run this in the terminal (or create the folders by hand; on Colab, create them inside MyDrive):

tecnomarket-dl/
├── .venv/                  # the virtual environment (local only; don't touch it)
├── data/
│   ├── raw/                # data exactly as it arrives (photos, review CSVs...)
│   └── processed/          # data already cleaned and ready for training
├── notebooks/              # one notebook per lesson/experiment: 02-05-first-network.ipynb...
├── models/                 # trained models we save (module 6)
├── figures/                # exported plots (training curves, etc.)
└── requirements.txt        # the exact library versions (see below)
# Commands to create it locally (Linux/macOS; on Windows, the equivalent mkdir)
cd tecnomarket-dl
mkdir -p data/raw data/processed notebooks models figures

Usage rules we will follow for the whole course:

  • data/raw is read-only: never modify the original data; every transformation is saved into data/processed. That way you can always start over.
  • One notebook per lesson or experiment, with a numbered name (03-02-cnn-cifar10.ipynb): the order of the course will be the order of your files.
  • Trained models go in models/ with a name and date: we will learn to save and load them in lesson 06-05.

Best practices: isolated environments and versions

Three professional habits that will spare you serious trouble:

  1. One isolated environment per project. The TecnoMarket project has its .venv; another project will have its own. That way, upgrading a library for one project doesn't break the others. Never install with pip outside an environment.

  2. Freeze your versions. Deep learning libraries change fast, and code that works today may fail with next year's version. Save your environment's exact versions:

# Save the environment's state into requirements.txt
pip freeze > requirements.txt

# Recreate the environment on another machine (or after breaking it)
pip install -r requirements.txt

In the TecnoMarket context this is critical: if the photo classifier goes into production, the team must be able to rebuild the exact environment where it was trained.

  1. Verify before you work. When something fails midway through the course, go back to the 00_verification.ipynb notebook and run it: within seconds you will know whether the problem is the environment or your code.

Later on, in lesson 06-04, we will look at more advanced environments and resources (IDEs, experiment tracking, cloud alternatives); for now, with Colab or your verified local environment you have everything you need.

Common Mistakes and Tips

  • Mistake: training on Colab without enabling the GPU. Colab starts with no accelerator by default. If a training run is suspiciously slow, the first thing to check is Runtime → Change runtime type.
  • Mistake: installing packages without activating the environment. If pip install works but import then fails in the notebook, you almost certainly installed into a different Python than the one Jupyter uses. Activate the environment before installing and before launching Jupyter.
  • Mistake: losing your work on Colab. The session disk is ephemeral. Any data and models you want to keep go to mounted Google Drive, always.
  • Mistake: typing python when the system has python3. On Linux/macOS the command may be called python3; inside an activated environment, python already points to the right version.
  • Mistake: running notebook cells out of order. If inconsistent results appear, Kernel → Restart & Run All and review from top to bottom.
  • Tip: don't chase the latest version of every library; chase a stable, frozen environment in requirements.txt. Reproducibility is worth more than novelty.

Exercises

Exercise 1: Getting started on Colab

Create a notebook on Google Colab called 00_verification, enable the GPU, run this lesson's full verification script and check that both frameworks detect the GPU. Then disable the GPU (switch back to CPU), restart the runtime and run it again. Compare both outputs: which lines change?

Exercise 2: A reproducible local environment

On your machine: create the tecnomarket-dl folder with the lesson's folder structure, create and activate a virtual environment, install the course libraries, generate the requirements.txt and run the verification script in a local Jupyter. Note down which version of Python, TensorFlow and PyTorch you ended up with.

Exercise 3: Diagnosing a failure

A colleague on TecnoMarket's data team writes to you: "I installed torch with pip and it said everything was fine, but when I do import torch in my notebook I get ModuleNotFoundError". List, in order of likelihood, the possible causes and the command or check you would use to rule out each one.

Solutions

Solution 1:

With the GPU enabled, nvidia-smi shows the assigned card, and the verification lines say GPU visible to TensorFlow: YES and GPU visible to PyTorch: YES -> Tesla T4 (or another model); the mini test reports device 'cuda'. After switching back to CPU, both lines change to NO (will use CPU), the mini test reports 'cpu' and nvidia-smi errors out ("command not found" or similar, because the assigned machine has no GPU). The Python and library versions do not change: only the available hardware changes, not the software.

Solution 2:

Expected sequence (Linux/macOS):

mkdir tecnomarket-dl && cd tecnomarket-dl
mkdir -p data/raw data/processed notebooks models figures
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install tensorflow torch torchvision numpy pandas matplotlib scikit-learn jupyter
pip freeze > requirements.txt
jupyter notebook

The specific versions will depend on when you install (for example, Python 3.11.x, TensorFlow 2.x, PyTorch 2.x); what matters is that the verification script runs without import errors and that requirements.txt captures the exact versions so the environment can be reproduced.

Solution 3:

In order of likelihood:

  1. They installed into a different Python than the one the notebook uses (the most common case): they installed with the environment deactivated, or Jupyter runs on another environment. Check: in a cell, import sys; print(sys.executable) and compare with the path where pip installed (which pip / pip -V in the terminal). Fix: activate the correct environment and install there, or launch Jupyter from within the environment.
  2. The notebook's kernel is not the environment's kernel: Jupyter may have several kernels registered. Check: menu Kernel → Change kernel.
  3. They didn't restart the kernel after installing: if the notebook was already open when installing, a Kernel → Restart is sometimes needed.
  4. The installation actually failed (running out of disk space, a network error they missed). Check: pip show torch in the terminal with the environment activated.

Conclusion

Your workshop is set up: you know how to work with Google Colab and its free GPU, you have (or know how to create) an isolated local environment with TensorFlow and PyTorch, you have the basic Jupyter moves down, you have a verification script to diagnose the environment at any time, and the TecnoMarket project folder structure is ready to receive the notebooks, data and models for the whole course. Remember the three golden rules: isolated environments, frozen versions and untouchable raw data.

This wraps up the introductory module: you know what deep learning is, where it comes from, what it is for, what networks are made of and where you are going to build them. In module 2 the truly hands-on part begins: from the perceptron to the multilayer perceptron, activation functions, propagation and optimization... all the way to training your first complete neural network with real data.

© Copyright 2026. All rights reserved