Skip to content
Latchkey

uv export: Export the Lockfile to requirements.txt

uv export renders uv.lock as a requirements.txt that other tools (Docker, pip) can consume.

uv export bridges a uv project to anything that still wants requirements.txt. It reads the lockfile and writes a pinned, hashed requirements file without re-resolving.

What it does

uv export reads uv.lock and emits the resolved dependency set in requirements.txt format on stdout (or to a file). By default it includes hashes and the default dependency groups; flags trim what is included.

Common usage

Terminal
uv export -o requirements.txt
uv export --no-hashes -o requirements.txt
uv export --no-dev -o requirements.txt
uv export --only-group docs -o docs-requirements.txt
uv export --frozen -o requirements.txt

Options

FlagWhat it does
-o, --output-file <file>Write to a file instead of stdout
--no-hashesOmit the --hash lines
--no-devExclude the dev dependency group
--only-group <name>Export only one group
--format <fmt>Output format, e.g. requirements.txt
--frozenUse the existing lock without re-locking

In CI

A common pattern is uv export --frozen -o requirements.txt to feed a Docker build that installs with pip. Use --frozen so CI fails loudly if uv.lock drifts from pyproject.toml rather than silently re-resolving. Keep --no-hashes off unless the consumer rejects hashes.

Common errors in CI

"error: The lockfile at uv.lock needs to be updated, but --frozen was provided" means pyproject.toml changed without re-locking; run uv lock and commit it. "error: Unable to find lockfile" means there is no uv.lock; run uv lock first. An empty output usually means everything was filtered out by --only-group on a missing group.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →