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.

Install uvuv --versionuv run --withoptional --script metadata

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. 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. 2

    Write a script that imports a third-party package

    Use from rich.progress import track as in the scripts guide. python example.py and uv run --no-project example.py both miss rich.

  3. 3

    Prove it with uv run --with

    Run uv run --with rich example.py. Constraints: uv run --with 'rich>12,<13' example.py.

  4. 4

    Pin deps with inline metadata

    uv add --script example.py rich writes a PEP 723 # /// script block. Then uv run example.py. Inline metadata ignores project deps even inside a pyproject.toml tree.

# 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.py

Which invocation to use

CommandWhat happensUse when
python example.pySystem interpreter; often missing packagesNot the first command after installing uv
uv run --with rich example.pyInstalls deps for this invocationProve the toolchain works
uv add --script then uv runDeps live in the file headerYou will rerun the same script
Directory has pyproject.tomlWithout inline metadata, installs the project firstAdd --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.

Start a free meeting