Python module
Getting started
Your Python practice environment
Install Python 3.11+ on Windows, macOS, or Linux. This site never runs Python — you will.
beginner40 minRun on your machine
What you will be able to do
- Install or confirm Python 3.11+ so python3 and pip work in your terminal
- Run a one-line script and see the output
- Create the ~/dcubes/python-lab folder used in every later lesson
Why this exists
Data jobs are Python scripts in a controlled environment: extract, transform, load, score. A website that ran Python for you would not teach the skill. You type. Your machine runs Python.
Do Linux Getting Started and Docker Getting Started first if you do not yet have a prompt, ~/dcubes, and Compose. This page adds Python next to that prompt.
Pick your operating system
Open the section that matches how you practiced Linux and Docker.
Windows — WSL (Ubuntu)
You already have Ubuntu in WSL. Install Python inside Ubuntu, not only on Windows.
1. Update and install
sudo apt update
sudo apt install --yes python3 python3-venv python3-pip
2. Check versions
python3 --version
python3 -m pip --version
What you should see: Python 3.10 or newer (3.11+ preferred). Ubuntu 22.04 often ships 3.10; 24.04 ships 3.12. Either works for this module.
If python3 is missing, the apt install failed — re-read the error before installing from a random website.
3. How to come back tomorrow
Open the Ubuntu app (same window as Linux/Docker). You do not reinstall.
macOS — Homebrew or python.org
Option A — Homebrew (recommended if you already use brew)
brew install python@3.12
Then:
python3 --version
python3 -m pip --version
Option B — Official installer
- Open python.org downloads for macOS.
- Install a 3.11 or 3.12 package from that page (not a random mirror).
- Open Terminal and run the version checks above.
Homebrew and the official installer both put python3 on your PATH. Prefer one path and stick to it for this module.
Linux desktop — apt
Ubuntu or Debian as your actual desktop (not WSL):
sudo apt update
sudo apt install --yes python3 python3-venv python3-pip
python3 --version
python3 -m pip --version
On Fedora, the same idea is sudo dnf install python3 python3-pip. Later lessons use python3 and python3 -m venv.
VirtualBox Ubuntu VM
If you used the VirtualBox Ubuntu fallback, install inside the VM, same as Linux desktop above.
Ready checklist
From the same terminal you use for Linux and Docker, run these one at a time.
python3 --version
You want 3.10+ (ideally 3.11 or 3.12). Version text will not match the example exactly. That is success.
python3 -m pip --version
You should see a pip version and a path under your Python install.
python3 -c "print('dcubes-python-ok')"
dcubes-python-ok
Create the lab folder
Every Python lesson uses this directory:
mkdir -p ~/dcubes/python-lab
cd ~/dcubes/python-lab
pwd
You should see a path ending in python-lab.
First file
cd ~/dcubes/python-lab
cat > hello.py << 'EOF'
print("hello from python-lab")
EOF
python3 hello.py
hello from python-lab
Optional: Python in Docker
You already know images. A job might use python:3.12-slim later. This module installs Python on the host (or WSL) so editing and venvs stay simple. Packaging scripts in images comes after you can run them locally.
Common mistakes
- Using Windows
pythonfrom PowerShell while lessons assume Ubuntu. Stay in the WSL Ubuntu terminal for this module. - Python 2 leftovers. Always type
python3, not barepython, unlesspython --versionalready shows 3.x. - Skipping
python3-venv. On Debian/Ubuntu, venv is a separate package. Install it now if apt did not. - Installing from a blog
curl | bash. Use apt, Homebrew, or python.org only.