0. Setting up¶
Set up once, allowing time for downloads and troubleshooting. Steps 1 and 2 need internet access; afterwards the supplied code, data and generated reports work offline. The zip does not include Python or its packages. For formatted tutorials offline, save the web sections as PDFs while connected, or use a Markdown reader that supports equations; the bundled tutorial files are Markdown source.
On Windows, before you start:
Unzip the unit properly. Right-click the downloaded zip file and choose Extract All. Working inside the zip without extracting it does not work.
Open Command Prompt in the unit’s folder. Open the extracted folder in File Explorer, click the address bar at the top, type
cmdand press Enter. (On Windows 11, “Open in Terminal” opens PowerShell; see the table at the end of this section if you use it.)
Step 1. Python¶
You need Python 3.10 or later. Maintainer CI currently tests Python 3.10–3.13; lecturers should check the environment they intend to use for a class.
Windows: follow the official Python installation guidance. Current installations may use the Python install manager; older installers offer “Add python.exe to PATH”. Follow the instructions for your installer. Or use an existing Anaconda installation (see below).
macOS: install Python from python.org, or with Homebrew (
brew install python).Linux: Python 3 is usually installed already.
Check it in a terminal (on Windows, Command Prompt):
System |
Command |
|---|---|
Windows |
|
macOS, Linux |
|
Step 2. A virtual environment for this unit¶
A virtual environment isolates this unit’s Python packages from those used
by other projects. Open a
terminal in this unit’s folder (the folder that contains verify.py) and
run the three lines for your system.
Windows (Command Prompt):
py -m venv .venv
.venv\Scripts\activate
python -m pip install -r requirements.txt
macOS and Linux:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
The second line activates the environment: your prompt now starts with
(.venv). Each time you open a new terminal, run the second line again.
Once the environment is active, the command is python on every system.
Anaconda users: skip step 2. Open the Anaconda Prompt, go to this unit’s folder with
cd, and usepython. NumPy, SciPy and Matplotlib come with Anaconda.
Step 3. Check¶
python -c "import numpy, scipy, matplotlib; print('ready')"
It should print ready.
If something goes wrong¶
What you see |
Why |
What to do |
|---|---|---|
|
Outside a virtual environment the command is |
Activate the environment (step 2, second line) |
|
Your system’s Python does not allow installing packages directly |
Use the virtual environment in step 2 |
|
The packages are not installed in the Python you are using |
Activate the environment, then run the |
|
The environment is not active, or Python is not on your PATH |
Activate the environment (step 2, second line). Before step 2, use |
Typing |
Windows’ placeholder “app alias” for Python |
Install Python from python.org, or turn off the alias in Settings, Apps, Advanced app settings, App execution aliases |
|
The launcher or install manager is unavailable in this terminal |
If |
|
PowerShell blocks the activation script |
Use Command Prompt instead of PowerShell |
|
The virtual-environment module is not installed |
Run |
Fill in your details¶
Open student/student_info.txt in a text editor (Notepad is fine) and fill in
every line. These details appear at the top of your report.
Share the report through your lecturer’s agreed submission route. Do not post
student identifiers in a public repository or issue.
Run the checks for the first time¶
With the environment active, in this unit’s folder:
python verify.py
You should see:
verifiedmethods A1: ODE initial value problems (version ...)
Running the checks (a few seconds; the first run can take longer)...
Euler euler_step is not implemented yet.
Heun heun_step is not implemented yet.
Classical RK4 rk4_step is not implemented yet.
Report: .../report/verification-report.html
That is correct: you have not written anything yet. Open the report file in
any web browser to see what it looks like. If you see a line starting
Remember to fill in, some of your details are still empty.
Edit, save and rerun¶
Open student/steps.py in a code editor or plain-text editor. Keep its
filename and the supplied function names. On Windows, check that the filename
has not become steps.py.txt; do not use a word processor.
Save your changes, then run python verify.py again in the terminal in the
unit’s folder. Enter terminal commands at the system prompt, not at Python’s
>>> prompt; type exit() to leave that prompt if necessary. Your browser
may need a refresh to show the new report.
The folders¶
Folder or file |
What it is |
Do you edit it? |
|---|---|---|
|
Your three step functions |
Yes |
|
Your details and AI-use disclosure |
Yes |
|
Contribution statement for your appendix |
Yes |
|
The checks and the report generator |
No |
|
This tutorial and the project briefs |
No |
|
Your virtual environment (created in step 2) |
No |