Complete setup and credentials guide
Use this page when setting up a computer, then return to the relevant section when a lesson needs an additional package or provider. You can complete the foundations, data, and RAG lessons without an API token.
Safety and permission first
Before creating a token:
- Ask a parent, teacher, or club leader if your school requires approval.
- Check the provider’s age, account, billing, and acceptable-use rules.
- Use a school-approved account, not another person’s token.
- Set a spending limit or use a free educational allocation when available.
- Never paste a token into chat, a notebook, a screenshot, a Git commit, or an issue.
- If a token is exposed, revoke it immediately and tell the supervising adult.
An API token is a password that lets a program act as your account. It is not a lesson answer and should not be shared with classmates.
1. Install Python
Install a current Python 3 release from the official Python downloads page. During installation on Windows, enable the option to add Python to PATH if the installer offers it.
Check the installation:
python --version
If that command is unavailable:
python3 --version
On Windows PowerShell, also try:
py --version
Use the command that reports Python 3 for the remaining commands. Do not mix multiple Python installations without checking which one owns the active environment.
2. Create a project environment
Create one folder per project. From that folder:
macOS or Linux:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
Windows PowerShell:
py -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
Windows Command Prompt:
py -m venv .venv
.venv\Scripts\activate.bat
python -m pip install --upgrade pip
Confirm that the active interpreter owns package installation:
python -c "import sys; print(sys.executable)"
python -m pip --version
Install the shared data and notebook dependencies:
python -m pip install -r requirements-student.txt
Install advanced or provider-specific packages only when a lesson requires them.
3. Start Jupyter
From the activated environment:
jupyter lab
Open the local URL printed by Jupyter. Create a notebook inside the project folder, select the environment’s Python kernel, and run:
import sys
print(sys.executable)
print("Notebook setup works")
If the notebook kernel does not use .venv:
python -m pip install ipykernel
python -m ipykernel install --user --name techclub-project --display-name "Python (techclub-project)"
Read the Jupyter notebook workflow before running an imported exercise.
3a. Use Jupyter in VS Code
VS Code can run notebooks through its official extensions, so you do not have to open JupyterLab in a browser.
- Install Visual Studio Code.
- Open the Extensions view (
View→Extensions). - Install Python by Microsoft (
ms-python.python). - Install Jupyter by Microsoft (
ms-toolsai.jupyter). - Open the project folder that contains
.venv. - Open an existing
.ipynbfile or create a new Jupyter Notebook from the Command Palette. - Select the
.venvinterpreter:- Open the Command Palette with
Cmd+Shift+Pon macOS orCtrl+Shift+Pon Windows/Linux. - Run Python: Select Interpreter.
- Choose the interpreter inside
.venv.
- Open the Command Palette with
- In the notebook’s top-right Select Kernel menu, choose the same
.venvPython environment. - Run the setup cell first, then run cells from top to bottom with the play button or
Shift+Enter.
Verify the selected kernel with:
import sys
print(sys.executable)
The printed path should contain .venv. If the environment is not listed, run the ipykernel installation command above in the activated environment, then reload VS Code and select the kernel again.
Useful VS Code actions:
| Action | How |
|---|---|
| Run the current cell | Shift+Enter or the cell play button |
| Run all cells | Notebook toolbar → Run All |
| Restart notebook state | Notebook toolbar → Restart Kernel |
| Choose another environment | Select Kernel → choose a different Python interpreter |
| Inspect variables | Open the Variables view while a cell is paused or after it runs |
| Convert a Python script into cells | Separate sections with # %%, then use Run Cell |
Do not use the Run All button until you have read the notebook. Imported notebooks may call external services, create files, or use credentials.
4. Install optional packages
Install packages into the active environment with python -m pip:
python -m pip install package-name
For the API exercises:
python -m pip install anthropic python-dotenv
For PyTorch, follow the official installation selector because the correct command depends on the operating system and hardware.
5. Use a local environment file safely
For API exercises, create a file named .env in the project folder. Never commit it:
ANTHROPIC_API_KEY=replace_with_your_token
ANTHROPIC_MODEL=replace_with_a_model_name_allowed_by_your_account
GITHUB_TOKEN=replace_with_your_github_models_token
Only define variables needed by the exercise. The repository’s .gitignore excludes .env and .env.* while allowing an example file. Keep values private and do not print them.
Load variables in Python:
import os
from dotenv import load_dotenv
load_dotenv()
required = "ANTHROPIC_API_KEY"
if not os.getenv(required):
raise RuntimeError(f"Set {required} in .env before running this exercise.")
print("Credential name found; value was not displayed.")
6. Direct Claude API exercise
The prompt-structure exercise uses the Anthropic Python SDK. Read the official Anthropic API documentation and confirm that your account and school allow the use.
Set ANTHROPIC_API_KEY and, if the lesson requires it, ANTHROPIC_MODEL in .env. The exercise loads them through python-dotenv; it must not contain a literal key.
A safe initialization check is:
import os
from anthropic import Anthropic
from dotenv import load_dotenv
load_dotenv()
if not os.getenv("ANTHROPIC_API_KEY"):
raise RuntimeError("ANTHROPIC_API_KEY is missing.")
client = Anthropic()
print("Anthropic client initialized.")
Client initialization does not prove that the account can use a selected model. Follow the provider’s current model and usage documentation when a request fails.
7. GitHub Models exercise
The chatbot exercise uses a GitHub token with access to the configured GitHub Models endpoint. Read the GitHub Models documentation and follow your school’s approval process before requesting access.
Create a token with the least privilege required by the exercise and store it only as:
GITHUB_TOKEN=replace_with_your_token
The notebook reads GITHUB_TOKEN from the environment and sends it as an authorization header. Never replace that code with a literal token. Model names, endpoint URLs, availability, quotas, and permissions can change; use provider documentation if the imported exercise reports an access or model error.
8. Keyless learning path
You do not need credentials to learn most of TechClub:
- Complete Python, NumPy, pandas, visualization, statistics, and classical ML locally.
- Run the RAG chunking exercise with its embedded sample document.
- Practice prompt design using written mock responses.
- Use a local or school-provided model only after checking privacy and hardware requirements.
- Replace API calls with a function that returns a fixed sample response while learning application structure.
A project is valid when it demonstrates the workflow with a safe local substitute.
9. Troubleshooting setup
| Problem | Check |
|---|---|
| Package imports fail | Activate .venv, run python -m pip show package-name, and verify the notebook kernel path. |
.env seems ignored |
Confirm the file is named exactly .env and is in the project folder. |
| Token appears missing | Restart the kernel after changing .env; do not print the token. |
| Access or model error | Check account permission, provider documentation, model availability, quota, and endpoint configuration. |
| Windows activation is blocked | Ask an administrator or use Command Prompt; do not weaken security policy without adult guidance. |
| Requests cost money | Stop, check quotas and billing, and ask the supervising adult before retrying. |
For help, include the Python version, operating system, package versions, exact error message, and smallest failing code. Never include .env contents. Continue with the troubleshooting guide.
Setup completion checklist
- Python 3 runs from the intended interpreter.
- A project
.venvis active. - Shared packages install successfully.
- Jupyter starts with the project kernel.
- A notebook runs from a fresh kernel.
.envis ignored and contains no committed secret.- Provider account and school permissions are confirmed before API use.
- A keyless fallback is available.