Skip to content
Latchkey

poetry export: Export to requirements.txt

Turn poetry.lock into a pip-installable requirements file.

poetry export writes the locked dependencies to requirements.txt format, so a Docker stage or tool that only understands pip can install the exact same versions.

What it does

Renders the lockfile as requirements.txt (or constraints.txt), optionally with hashes and selected groups. In Poetry 1.2+ export lives in the poetry-plugin-export plugin.

Common usage

Terminal
poetry export -f requirements.txt -o requirements.txt
poetry export --without-hashes -o requirements.txt
poetry export --with dev -o requirements-dev.txt

Common CI error: export command missing

In recent Poetry, "poetry export" is not built in and errors as an unknown command until the plugin is installed. Add the export plugin first.

Terminal
# Failure:
# The command "export" does not exist.

# Fix:
poetry self add poetry-plugin-export
poetry export -f requirements.txt -o requirements.txt

Related guides

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