uv is installed; python still fails
Installing uv does not make python pick up deps; the first success is uv run.
After installing uv, python example.py still raises ModuleNotFoundError. The first command that actually runs is uv run --with rich example.py. Open a wbmeet room and walk the terminal output.
The query is uv how to use uv run python ModuleNotFoundError. This page follows docs.astral.sh/uv/getting-started/installation/ and docs.astral.sh/uv/guides/scripts/ (2026-11-27). Related: Aider’s first diff and Aider install note. Align on output in wbmeet; see create and join a room.
uv on PATH is not python with packages
python uses the local interpreter and its site-packages. uv run creates or updates an environment from declared deps. Treat uv as a pip alias and still hand the file to python, and the official rich sample prints No module named 'rich'.
Four steps to the first script that runs
- 1
Install from the official page
Standalone installer, Homebrew, or pipx. Open a new terminal and run
uv --version. An old shell may still lack PATH. - 2
Write a script that imports a third-party package
Use
from rich.progress import trackas in the scripts guide.python example.pyanduv run --no-project example.pyboth missrich. - 3
Prove it with uv run --with
Run
uv run --with rich example.py. Constraints:uv run --with 'rich>12,<13' example.py. - 4
Pin deps with inline metadata
uv add --script example.py richwrites a PEP 723# /// scriptblock. Thenuv run example.py. Inline metadata ignores project deps even inside apyproject.tomltree.
# docs.astral.sh/uv · 2026-11-27
curl -LsSf https://astral.sh/uv/install.sh | sh
uv --version
uv run --with rich example.py
uv add --script example.py rich
uv run example.py
uv run --no-project example.pyWhich invocation to use
| Command | What happens | Use when |
|---|---|---|
python example.py | System interpreter; often missing packages | Not the first command after installing uv |
uv run --with rich example.py | Installs deps for this invocation | Prove the toolchain works |
uv add --script then uv run | Deps live in the file header | You will rerun the same script |
Directory has pyproject.toml | Without inline metadata, installs the project first | Add --no-project for a standalone script |
FAQ
Why does python still miss packages after installing uv?
uv is a package and project manager. python does not switch into the env uv prepared for this invocation. Use uv run.
Can I use uv pip install?
uv has a pip-compatible interface, but the scripts guide’s first successful path is uv run with --with or inline metadata—not a global pip then python.
How do I install on Windows?
Official: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex". WinGet id astral-sh.uv is also listed.
To walk a command together, open a room on wbmeet—create and join.