Note: If you need further explanations and instructions on how to use this repo for submitting assignments please see Student Workflow Guide
This guide will help you set up a Python development environment for this course using modern Python tools. All of our homework and programming assignments were created and completed using this environment. You may add to the environment if you so choose, we are just providing a base environment to help start you on the right foot. We will update this repository as Python changes but it works as of 1/19/2026.
Claude Code wrote the instructions on how to do this for Windows as I have never used pyenv with Windows so mileage may vary. I would suggest using your WSL2 Linux environment to do your work for this course if you are using a Windows machine.
You'll need to install two tools:
- pyenv - to manage Python versions
- uv - to manage virtual environments and dependencies (faster alternative to pip/venv)
# Install pyenv
curl https://pyenv.run | bash
# Add to your shell configuration (~/.bashrc, ~/.zshrc, or ~/.bash_profile)
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
# Reload your shell
source ~/.bashrcUse pyenv-win:
# In PowerShell
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"Then restart your terminal.
# Install Python 3.13 (latest version)
pyenv install 3.13
# Set it as your global Python version (optional)
pyenv global 3.13
# Verify installation
python --version
# Should show: Python 3.13.xcurl -LsSf https://astral.sh/uv/install.sh | shpowershell -c "irm https://astral.sh/uv/install.ps1 | iex"pip install uv- Navigate to the project directory:
cd path/to/base-environment- Create and sync the virtual environment:
uv syncThis command will:
- Create a
.venvdirectory with a virtual environment - Install all required dependencies listed in
pyproject.toml - Create/update a
uv.lockfile to ensure reproducible installs
- Activate the virtual environment:
On macOS/Linux:
source .venv/bin/activateOn Windows (PowerShell):
.venv\Scripts\Activate.ps1On Windows (Command Prompt):
.venv\Scripts\activate.batYou should see (base-environment) appear in your terminal prompt.
Run the test script to verify everything is working:
python main.pyIf all dependencies are installed correctly, the script will confirm your setup is complete.
When you start working on this project:
-
Activate the virtual environment:
source .venv/bin/activate # macOS/Linux .venv\Scripts\Activate.ps1 # Windows PowerShell
-
Work on your code - all packages will be available
-
Deactivate when done:
deactivate
uv add package-nameuv remove package-nameuv sync --upgradeThis environment includes the following packages for algorithms and machine learning coursework:
- Data Processing: numpy, pandas, scipy
- Visualization: matplotlib, seaborn, plotly
- Machine Learning: scikit-learn, tensorflow, torch (PyTorch), transformers
- Statistical Analysis: statsmodels, lifelines
- Optimization: cvxopt
- Probabilistic Models: pgmpy
- Datasets: datasets (Hugging Face)
- Notebooks: jupyter, ipykernel
If uv sync fails due to Python version, ensure you're using Python 3.13:
python --version
pyenv local 3.13 # Set Python 3.13 for this directoryRestart your terminal after installing uv, or add it to your PATH manually.
If you get a script execution error on Windows, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUseruv is a modern Python package manager written in Rust that is:
- 10-100x faster than pip
- More reliable with better dependency resolution
- Compatible with existing Python tools and workflows
- Simpler with commands like
uv addanduv sync
Once you have the environment set up, this repository also includes Python implementations from a well-known AI algorithms textbook:
aima/— Implementations from Artificial Intelligence: A Modern Approach (AIMA), with interactive Jupyter notebooks
This is an excellent resource for understanding how the algorithms we cover in class actually work. When you're stuck on an algorithm, look at the reference implementation first — reading real code is often more helpful than asking ChatGPT or Claude, which can hallucinate details or give you subtly incorrect explanations. The textbook code is vetted, matches the pseudocode you'll see in lectures, and will build stronger intuition than an AI-generated summary.
Browse the notebooks — open any .ipynb file inside aima/ with Jupyter to see worked examples and visualizations:
jupyter notebook aima/search.ipynbImport modules directly in your own notebooks or scripts:
from aima.search import astar_search, breadth_first_graph_search
from aima.mdp import value_iteration
from aima.csp import backtracking_searchNote: Because
aima/lives at the root of this repo (not installed as a package), you need to run your code from the repo root so Python can find it. If you activate the virtual environment and launch Jupyter from the repo root, imports will work automatically.
Run the AIMA test suite to verify your understanding of how the algorithms behave:
python -m pytest aima/tests/See the aima/README.md for a full index of every implemented algorithm and which file it lives in.
pyenv install 3.13 fails with a build error (common on WSL2/Ubuntu):
If this is your first time setting up Python on the machine, you may be missing build prerequisites that pyenv needs to compile Python from source. Install the suggested dependencies for Ubuntu/Debian (from pyenv's build environment guide):
sudo apt update
sudo apt install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-devThen retry:
pyenv install 3.13pyenv not found after installation:
- Make sure you added pyenv to your shell configuration and restarted your terminal
uv command not found:
- Restart your terminal after installing uv
Python version mismatch:
- Run
pyenv local 3.13in the project directory
Package import errors:
- Make sure your virtual environment is activated:
source .venv/bin/activate - Run
uv syncto ensure all packages are installed
If you have questions about the environment setup, please ask during office hours or post on the question and answer discussion board.