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.txtCommon 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.txtRelated guides
poetry lock: Resolve and Write poetry.lockHow poetry lock resolves dependencies and writes poetry.lock without installing, the --no-update flag, and th…
pip install -r: Install from requirements.txt in CIHow pip install -r installs every dependency from a requirements file, the flags that make it reproducible in…
poetry install: Install from the LockfileHow poetry install resolves and installs dependencies from poetry.lock, the --no-root and --only flags useful…