Python tools
Install Python packages for a local project
Foundations and the core Intermediate exercises use the Python standard library. Follow this guide when you reach the optional Club File Pack lab or start a local project that names extra packages.
Choose the right tool
Some modules come with Python. Code can import math, csv, pathlib, json, unittest and pdb as soon as Python is installed.
A third-party package is code maintained outside Python. PyPI is the Python Package Index, where you can look up package names, supported Python versions and documentation. Open a project’s own documentation when deciding what to install.
Browse PyPIvenv comes with Python. It creates a separate environment for one project and normally includes pip, which installs libraries. Run python -m pip so the same Python sees the packages when it runs your code.
pipx installs standalone Python command-line applications in their own environments. uv is an optional tool that can also manage Python versions, project environments and dependencies. The course uses venv plus pip for its local package lab.
Read the official Python packaging guide
1. Find the supplied requirements
Download and extract the Intermediate Python workbook. Inside it, open the lesson folder below. It contains README.txt, requirements.txt and the scripts for the Club File Pack.
lessons/documents-and-images/build-a-club-file-packOpen a terminal in this lesson folder. Use Command Prompt on Windows or Terminal on Mac. List the files with dir on Windows or ls on Mac to check your location.
What you should see · requirements.txt, check_packages.py, make_fixtures.py, club_pack.py and verify_pack.py are visible.
Open requirements.txt in VS Code. Each line gives a package name and a version. Use Python 3.11 or newer for this lab. Check the selected Python version with py --version on Windows or python3 --version on Mac.
2. Create and activate a virtual environment
Windows. Run these two lines in Command Prompt from the folder that contains requirements.txt. Use python in place of py on the first line if that was your working installation command.
py -m venv .venv .venv\Scripts\activate.batMac. Run these two lines in Terminal from the same folder.
python3 -m venv .venv source .venv/bin/activateLook for (.venv) near the start of your terminal prompt. Confirm which pip your Python will use.
python -m pip --versionWhat you should see · A pip version and a path that contains .venv.
3. Install and check the packages
With the environment active, run this command while connected to the internet. -r tells pip to read requirements.txt. This lab uses prebuilt packages called wheels.
python -m pip install --only-binary=:all: -r requirements.txtCheck that the installed packages agree with each other and that the lab can import them.
python -m pip check python check_packages.pyWhat you should see · No broken requirements found. Then The four document packages are ready.
The packages are openpyxl for spreadsheets, pypdf for PDF pages, Pillow for images, and ReportLab for making sample PDFs. Pillow is a package name. Its Python imports start with PIL.
In VS Code, open the lab folder and choose Python: Select Interpreter. Select the .venv entry. For a later terminal session, activate the environment again from this folder. Type deactivate when you finish.
4. Run the lab
Generate the fictional input files, make the report pack, then verify it. Run each line with the environment active.
python make_fixtures.py python club_pack.py python verify_pack.pyWhat you should see · A pack folder with spreadsheet, PDF and image output. The verification script prints Verified the workbook, three PDF pages and two PNG copies.
The verification script reads the files for you. To inspect them yourself, open PDF and PNG files in a browser. Open XLSX files in a spreadsheet app such as the free LibreOffice Calc.
Open an XLSX file in LibreOffice
Prepare a copy for a classroom without internet
On a connected computer with the same operating system, CPU architecture and Python major and minor version as the classroom computer, open the lab folder and activate its environment. Download the wheels while connected.
python -m pip download --only-binary=:all: -r requirements.txt -d wheelsWhat you should see · A wheels folder with the libraries and the packages they depend on.
Copy the workbook and the wheels folder to the classroom computer. Place wheels beside requirements.txt in the lab folder. Create and activate a fresh .venv there using the steps above. Install from the copied files.
python -m pip install --no-index --find-links=wheels -r requirements.txtRepeat the package check and run the lab scripts. Prepare a separate wheel folder for each different operating system, CPU architecture or Python minor version used in class.
Teacher option. If the classroom uses 64-bit Windows on Intel or AMD with CPython 3.15, this command can prepare those wheels from a connected Mac. Put the resulting folder beside requirements.txt on Windows and name it wheels. Use the matching-system instructions above for other targets.
python -m pip download --platform win_amd64 --implementation cp --python-version 3.15 --abi cp315 --only-binary=:all: -r requirements.txt -d windows-wheels
If an install or import fails
If Python says ModuleNotFoundError, compare the interpreter in your terminal with the one selected in VS Code, then check which environment holds the package.
python -c "import sys; print(sys.executable)" python -m pip show PillowIf the active .venv says No module named pip, bootstrap pip in that environment and repeat the version check.
python -m ensurepip --upgrade python -m pip --versionIf pip says requirements.txt could not be opened, return to the lab folder and list the files. If you see an externally managed environment message, activate the project’s .venv and run the install again.
If pip reports that a wheel is unavailable, check the supported Python versions and files on the package’s PyPI page. For a copied wheel folder, check the classroom computer’s OS, CPU architecture and Python version against the computer that prepared it.
See Pillow’s supported versions and wheelsCoding Studio runs the standard-library activities. Run the Club File Pack scripts in a local terminal or VS Code using the lab’s .venv.
Install Git when a lesson uses project history
Open Command Prompt on Windows or Terminal on Mac and check whether Git is already installed.
git --versionWhat you should see · A line starting with git version.
Windows. If Git is missing, download Git for Windows. Open the installer and keep the option that makes Git available from the command line. Close and reopen Command Prompt, then repeat git --version.
Get Git for WindowsMac. If Git is missing, install the Apple Command Line Tools. Follow the system installer, then reopen Terminal and repeat git --version.
Git setup options for Macxcode-select --installGit saves project versions on your computer. GitHub is a separate website for sharing repositories. Start with the local commands in your lesson.
Run the other local labs
The workshop HTTP lab uses two terminals and Python’s built-in http.server. Follow web-lab/README.txt. The exercise serves fictional files on your own computer and includes a saved response.
The Radio Shift Diagnostics lab uses Python’s built-in pdb debugger. Its README.txt gives the exact commands to type at the (Pdb) prompt.
The Stock Report lab uses Git and the built-in unittest module. Use the Git version check above, then follow the README in the lab folder. The normal files, reports, and capstones use Python’s standard library.