pip, requirements, and Virtual Environments

Scenario: Installing one project's package upgrade breaks another project.

New words, in plain English

Create with python3 -m venv .venv, activate it, then use python -m pip install .... Record deliberate pinned dependencies. Modern projects may use pyproject.toml, but requirements files remain common in automation.

Analogy: A Python program is like a clear set of instructions for a careful helper: names label things, indentation groups steps, and errors explain where the helper became confused.

A small, real example

python3 -m venv .venv
source .venv/bin/activate
python -m pip install pytest==8.3.3
python -m pip freeze > requirements.txt
Tip: Do not commit .venv; commit dependency declarations.
Goal: Practice this idea in the py-venv-requirements challenge at /labs/python. Fix the broken program, run it yourself, then use check to prove the real end state.