Skip to content
Latchkey

poetry install: Install from the Lockfile

Install exactly what the lockfile pins.

poetry install reads poetry.lock and installs the resolved dependencies into the project’s environment. It is the core dependency-restore step in a Poetry-based CI job.

What it does

Installs dependencies from poetry.lock (resolving and writing the lock first if it is missing). By default it also installs the project itself; flags control groups and whether the root package is installed.

Common usage

Terminal
poetry install
poetry install --no-root
poetry install --only main
poetry install --with dev --no-interaction

Common CI error: lockfile out of date

If pyproject.toml changed without re-locking, poetry install (with --no-update behavior) reports the lock is inconsistent. Run poetry lock to refresh it, then commit the updated lockfile.

Terminal
# Failure:
# pyproject.toml changed significantly since poetry.lock
# was last generated. Run `poetry lock` to fix the lock.

# Fix:
poetry lock
poetry install

Options

OptionDoes
--no-rootDo not install the project itself
--only GROUPInstall only the named group(s)
--with GROUPInclude an optional group
--without GROUPExclude a group
--syncRemove packages not in the lock

Related guides

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