Set up a reproducible Python workspace
Run your first local experiment and record the environment that produced it.
- Run a Python file locally
- Create an isolated environment
- Record seeds and environment details
A small local laboratory
Install Python 3.11 or newer from python.org and a text editor. Create a folder for your experiments. In a terminal, use python3 -m venv .venv on macOS or Linux, or py -m venv .venv on Windows. Activate it with source .venv/bin/activate on macOS/Linux or .venv\Scripts\activate.bat in Windows Command Prompt.
The Academy examples use the Python standard library: no API key, GPU, or package install is needed. Save the downloadable file in your project folder and run python followed by its filename inside your activated environment. Before activation, Windows may require py and macOS/Linux may require python3.
Make experiments repeatable
A seed creates a repeatable pseudorandom sequence for an experiment. Use a separate Random instance so unrelated code does not unexpectedly change the sequence. Record the input data and configuration alongside the result.
A seed alone does not guarantee identical results across every library, device, and version. For these small standard-library exercises, the environment printout and explicit seed make experiments easy to inspect. When adding third-party packages later, lock their versions and keep training and evaluation data versions too.
A small experiment you can run.
Save this as your-python-workspace.py and run it locally. The website provides code and interactive concept labs; it does not upload or execute arbitrary Python on a server.
import platform
import random
import sys
rng = random.Random(17)
print("Python:", sys.version.split()[0])
print("Platform:", platform.system())
print("Experiment:", [rng.randint(1, 20) for _ in range(5)])
assert random.Random(17).random() == random.Random(17).random()
Save the file, open your terminal in that folder, and run python your-python-workspace.py. Use python3 or py if required by your installation. Setup guide
Two runs with seed 17 produce the same five integers in your environment.
Create an experiment record.
- Run the file twice and compare the random sequence.
- Change the seed and run it again.
- Save a short note with your Python version, seed, and results.
Compare with a suggested solution
The same seed recreates the same sequence in the same environment. The system and Python version may differ on another machine. Record observations rather than claiming that a seed makes all software universally deterministic.
One idea to take with you.
Make it part of your progress.
Finish the practice and answer the knowledge check to mark this lesson complete.
Go deeper with primary documentation
Optional references for further study. This lesson and its examples were written for Artificials.
Python: virtual environments