This guide shows how to install Python using uv, a modern tool for managing Python versions, virtual environments, and dependencies.

  • New to Python environments? Start with Why Use uv
  • Already ready to install? Scroll down to Installing Python with uv

Before installation, it helps to understand why tools like uv are useful.


Why Use uv for Python?

Why Python Needs Better Environment Management

Python began as a lightweight scripting language and grew rapidly because it was easy to learn and widely adopted far beyond traditional software engineering communities. Researchers, analysts, scientists, and students often use Python productively without formal training in lower-level languages such as C or C++. That accessibility is one of Python’s greatest strengths, but it also created challenges around package management, version control, and reproducibility.

Common Problems Students Run Into

1. Python Version Conflicts

Different projects may require different Python versions.

Example:

  • One package may require Python 3.12
  • Another older project may only work on Python 3.10

Without version management, installing one environment can break another.


2. Dependency Conflicts

Python projects often depend on many external packages.

Example:

  • Project A needs pandas 2.x
  • Project B needs pandas 1.x

Installing packages globally can cause conflicts, errors, or broken projects.


3. Reproducibility Problems

Code that works on one machine may fail on another if:

  • package versions differ
  • dependencies are missing
  • environments are inconsistent

This is a common issue in research, teaching, and collaborative work.


Why uv Helps

uv provides:

  • Fast Python installation
  • Isolated virtual environments
  • Reliable dependency management
  • Reproducible project setups
  • A simpler workflow than traditional tools

Think of uv as a modern tool that helps manage:

  • Python itself
  • project environments
  • packages and dependencies

all in one place.


Traditional Workflow vs uv Workflow

Traditional approach:

Install Python
Create venv
Activate venv
Install pip packages
Resolve dependency problems manually

With uv:

Install uv
Install Python
Create environment
Run Python or Jupyter

Fewer steps, fewer errors.


Suggested Visuals for This Section

Consider adding:

  1. Python ecosystem diagram
  • Python core
  • Packages
  • Virtual environments
  • uv managing all layers
  1. Dependency conflict illustration
  • Two projects needing different package versions
  1. Workflow comparison graphic
  • Traditional pip/venv vs uv workflow
  1. “Works on my machine” reproducibility cartoon
  • A simple visual showing inconsistent environments

Installing Python with uv

Step 1: Install uv

Open Windows PowerShell and run:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

To confirm uv installed successfully:

uv --version

If installed correctly, you should see a version number.


Step 2: Install Python 3.12

Run:

uv python install 3.12

Step 3: Start Python

Launch Python:

uv run python

You should see:

>>>

To exit:

exit()

Optional: Create a Virtual Environment

Create a virtual environment:

uv venv --python 3.12

Activate:

.venv\\Scripts\\activate

Using Python in Jupyter Notebook

Install Jupyter:

uv add jupyter

Launch Jupyter:

uv run jupyter notebook

Using Python in VS Code

  1. Open Command Palette (Ctrl+Shift+P)
  2. Select:
Python: Select Interpreter
  1. Choose:
  • Python 3.12.x
  • or the .venv interpreter

This allows you to run:

  • .py scripts
  • .ipynb notebooks

Troubleshooting

PowerShell blocks activation script

Run:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Then try:

.venv\\Scripts\\activate

uv is not recognized

Close and reopen PowerShell, then run:

uv --version

Minimal Setup (Fastest Path)

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
uv python install 3.12
uv run python

Questions?

If you have any questions or run into any issues, please contact the lab assistant.