Isolated Environments and Packages
Meet uv After the Pieces Make Sense
The recovery sequence works, and every part of it belongs to ordinary Python. Keep that model. It lets you understand the faster tool instead of memorizing another ritual.
Create and activate .venv if this visit does not have one, then install the exact uv release stocked for the course:
python -m venv .venv
source .venv/bin/activate
python -m pip install uv==0.12.3
uv --version
The final command should report uv 0.12.3.
uv is a modern Python project and package tool. It is written to make environment creation and dependency installation fast. It does not change why projects need isolation or which file records this chapter’s dependency.
Map the new commands to the old jobs
Here are the two spellings side by side:
| Job | Standard Python tools | uv |
|---|---|---|
| Create the environment | python -m venv .venv | uv venv .venv |
| Install the recipe | python -m pip install -r requirements.txt | uv pip install -r requirements.txt |
Because uv is currently installed inside your active .venv, use it there for the install half:
uv pip install -r requirements.txt
python check_package.py
The check still prints requests 2.34.2. The project requirement did not change. You changed the tool that brought the environment into agreement with it.
On your own computer
For this chapter, installing uv with pip keeps the bootstrap visible and works on every platform branch. Later project tooling may offer a standalone uv installer, but that is not needed to understand or finish this chapter.
source .venv/bin/activate
python -m pip install uv==0.12.3
uv pip install -r requirements.txt
.\.venv\Scripts\Activate.ps1
python -m pip install uv==0.12.3
uv pip install -r requirements.txt
If activation is blocked, run .\.venv\Scripts\python.exe -m pip install uv==0.12.3, then .\.venv\Scripts\uv.exe pip install --python .\.venv\Scripts\python.exe -r requirements.txt.
source .venv/bin/activate
python -m pip install uv==0.12.3
uv pip install -r requirements.txt
What changes when you use uv pip install -r requirements.txt instead of the pip spelling?
The chapter closes by writing the recovery path for someone who does not have your current shell, your current machine, or your current .venv.