/errors/poetry/pyproject-toml-changed-significantly
pyproject.toml changed significantly since poetry.lock was last generated. Run `poetry lock`
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
- tool
- Poetry
- exit code
- 1
- versions
- Poetry 1.x – 2.x
- os
- any
pyproject.toml changed significantly since poetry.lock was last generated. Run poetry lock to fix the lock file. means the dependency sections of pyproject.toml no longer match the content hash stored in poetry.lock, so Poetry will not install from an out-of-date lock. Run poetry lock (Poetry 2 keeps the already locked versions where possible) and commit the new poetry.lock.
Reproduce it
cat > pyproject.toml <<'EOF'
[project]
name = "demo"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = []
[tool.poetry]
package-mode = false
EOF
# keep the virtual environment inside the project folder
uvx -q poetry@2.5.1 config virtualenvs.in-project true --local
uvx -q poetry@2.5.1 lock -q
# add a dependency without re-locking
sed -i 's/dependencies = \[\]/dependencies = ["six (==1.16.0)"]/' pyproject.toml
uvx -q poetry@2.5.1 check --lockOutput · exit 1
Error: pyproject.toml changed significantly since poetry.lock was last generated. Run `poetry lock` to fix the lock file.
poetry install prints the same sentence and stops before installing anything.
Fix
cat > pyproject.toml <<'EOF'
[project]
name = "demo"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = ["six (==1.16.0)"]
[tool.poetry]
package-mode = false
EOF
uvx -q poetry@2.5.1 config virtualenvs.in-project true --local
uvx -q poetry@2.5.1 lock -q
uvx -q poetry@2.5.1 check --lockOutput
All set!
poetry lock in Poetry 1 and 2
| Poetry | poetry lock | Refresh everything |
|---|---|---|
| 1.x | Re-resolves and may upgrade every dependency; --no-update keeps locked versions | poetry lock |
| 2.x | Keeps locked versions where still valid (the old --no-update behaviour) | poetry lock --regenerate |
In CI, run poetry check --lock before poetry install: it exits 1 with this message when the lock is stale, which makes the failure obvious in the job log.
Sources
Related pages
errors · poetryPoetry could not find a pyproject.toml file in /path or its parentsPoetry commands need a pyproject.toml in the current folder or a parent, or fail with Poetry could not find a pyproject.toml file. Use poetry init, cd or -C.commands · poetrypoetry add --group dev pytest: add a development dependencypoetry add --group dev pytest records a development-only dependency; Poetry 2 writes it to [dependency-groups]. poetry install --without dev leaves it out.errors · uvuv: error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provideduv sync --locked fails when pyproject.toml changed but uv.lock was not regenerated. Run uv lock and commit uv.lock; --frozen skips the check entirely.commands · poetrypoetry lock: update poetry.lock without upgrading dependenciesIn Poetry 2, poetry lock updates poetry.lock and keeps locked versions; --regenerate rebuilds it. Catch a stale lock file with poetry check --lock in CI.