Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: The lock file is not up to date with the latest changes in pyproject.toml

When I am using a poetry command with Python 3.7, in my case:

poetry export -f requirements.txt

I am getting the following error:

Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.

So far clear, but if I run poetry update it upgrades my dependencies, which is not what I want at this time for my project. If I run poetry lock instead, it still upgrades dependencies.

How can I work around this?

like image 670
marcuse Avatar asked May 27 '20 10:05

marcuse


People also ask

How do you update a Pyproject toml poem lock file?

To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your pyproject.toml file) and update the lock file with the new versions. (This is equivalent to deleting the poetry.lock file and running install again.)

What is Pyproject toml?

pyproject.toml is the new unified Python project settings file that replaces setup.py . Editable installs still need a setup.py : import setuptools; setuptools.setup() To use pyproject. toml , run python -m pip install .

What does poetry lock -- no update do?

This command locks (without installing) the dependencies specified in pyproject.toml . By default, this will lock all dependencies to the latest available compatible versions. To only refresh the lock file, use the --no-update option. This command is also available as a pre-commit hook.

How do you update a poem version?

Poetry is able to update itself when installed using the official installer. If you want to install pre-release versions, you can use the --preview option. And finally, if you want to install a specific version, you can pass it as an argument to self update .


1 Answers

This is a known issue in Poetry.

The issue is resolved, use: poetry lock --no-update.

Old answer:

There is a current workaround with the following commands:

poetry add pathlib2
poetry remove pathlib2

Where pathlib2 is any library you don't already depend on and that has no dependencies on it's own, hence pathlib2.

Using these commands will rewrite the lockfile hashes and resolve the file conflict without upgrading any of the other packages used in the project.

like image 54
marcuse Avatar answered Oct 16 '22 17:10

marcuse