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-interactionIn 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
poetry add: Add a Dependency Command ReferenceReference for poetry add in CI and dev: adding a dependency to pyproject.toml and the lock, group and dry-run…
poetry lock: Resolve the Lockfile Command ReferenceReference for poetry lock in CI: resolving dependencies into poetry.lock without installing, the consistency…
poetry run: Run in the Project Env Command ReferenceReference for poetry run in CI: executing a command inside the project virtualenv without activating it, comm…