Skip to content
Latchkey

poetry install: Install from Lock Command Reference

Install exactly what the lockfile pins.

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

Common flags / usage

  • poetry install -- install deps plus the project itself
  • --no-root -- skip installing the project package
  • --only main -- install only the main dependency group
  • --with dev -- include an optional group
  • --sync -- remove packages not in the lock
  • --no-interaction -- never prompt (CI default)

Example

shell
- uses: actions/setup-python@v5
  with:
    python-version: '3.12'
- run: pipx install poetry
- run: poetry install --with dev --no-interaction

In CI

If pyproject.toml changed without re-locking, poetry install reports the lock is inconsistent -- run poetry lock and commit it. Cache Poetry virtualenvs directory (poetry config virtualenvs.in-project true keeps it at .venv) to speed repeated runs.

Key takeaways

  • poetry install restores dependencies pinned in poetry.lock.
  • --no-root and --only/--with control what gets installed.
  • Always pass --no-interaction in CI to avoid prompts.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →