1.1.0b3: Regression in handling python version constraints when running add/update #2950
Closed
Description
The 1.1.0b3
release introduces a regression in add
/update
command handling of a dependency's python
version constriants.
For example when attempting to update poetry's own dependencies, this happens.
SolverProblemError
The current project's Python requirement (>=2.7,<2.8 || >=3.5,<4.0) is not compatible with some of the required packages Python requirement:
- pre-commit requires Python >=3.6.1, so it will not be satisfied for Python >=2.7,<2.8 || >=3.5,<3.6.1
- pre-commit requires Python >=3.6.1, so it will not be satisfied for Python >=2.7,<2.8 || >=3.5,<3.6.1
- pre-commit requires Python >=3.6.1, so it will not be satisfied for Python >=2.7,<2.8 || >=3.5,<3.6.1
Because no versions of pre-commit match >2.6,<2.7.0 || >2.7.0,<2.7.1 || >2.7.1,<3.0
and pre-commit (2.6.0) requires Python >=3.6.1, pre-commit is forbidden.
And because pre-commit (2.7.0) requires Python >=3.6.1, pre-commit is forbidden.
So, because pre-commit (2.7.1) requires Python >=3.6.1
and poetry depends on pre-commit (^2.6), version solving failed.
at poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For pre-commit, a possible solution would be to set the `python` property to ">=3.6.1,<4.0"
For pre-commit, a possible solution would be to set the `python` property to ">=3.6.1,<4.0"
For pre-commit, a possible solution would be to set the `python` property to ">=3.6.1,<4.0"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers
The specification for pre-commit
is correct and as expected.
pre-commit = { version = "^2.6", python = "^3.6.1" }
Re-adding with exact constraints fail as well, but with futures
(python 2 only dependency).
$ poetry add pre-commit@latest --python='>=3.6.1,<4.0'
Using version ^2.7.1 for pre-commit
Updating dependencies
Resolving dependencies... (0.1s)
SolverProblemError
The current project's Python requirement (>=2.7,<2.8 || >=3.5,<4.0) is not compatible with some of the required packages Python requirement:
- futures requires Python >=2.6, <3, so it will not be satisfied for Python >=3.5,<4.0
Because futures (3.3.0) requires Python >=2.6, <3
and no versions of futures match >3.3.0,<4.0.0, futures is forbidden.
So, because poetry depends on futures (^3.3.0), version solving failed.
at poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For futures, a possible solution would be to set the `python` property to ">=2.7,<2.8"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers