Description
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: MacOS 10.14.6 Mojave
Poetry version: 1.0.2
Link of a Gist with the contents of your pyproject.toml file: n/a
Issue
When a dependency has a dependency with a PEP508 '@' URI reference pointing to a wheel, and particularly when the version of the requirement is >=10 then the version it parses is incorrect. Specifically it only parses the first digit of the version number.
In our case, our dependency (here ourdep
) has the following metadata:
Requires-Dist: log-setup @ https://.../log-setup/12/log_setup-14.0.0-py2.py3-none-any.whl
(private url censored)
Then we see in the debug logs:
1: fact: ourdep (479) depends on log_setup (1)
And therefore pippi update -vvv
fails with a SolverProblemError
.
1: conflict: ourdep (479) depends on log_setup (1)
1: ! ourdep (479) is partially satisfied by not ourdep (>=457,<479 || >479)
1: ! which is caused by "ourdep (>=457,<479 || >479) requires log-setup (1)"
1: ! thus: ourdep (>=457) requires log-setup (1)
1: ! not log-setup (1) is satisfied by log-setup (>=12)
1: ! which is caused by "ourproject depends on log-setup (>=12)"
1: ! thus: ourdep is forbidden
1: ! ourdep (>=457) is satisfied by ourdep (>=457)
1: ! which is caused by "ourproject depends on ourdep (>=457)"
1: ! thus: version solving failed
This is caused by the regexp for wheels in poetry/packages/__init__.py
in dependency_from_pep_508()
:
if link.is_wheel:
m = re.match(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))", link.filename)
which is too non-greedy and only matches the first digit:
(Pdb) link.filename
'log_setup-14.0.0-py2.py3-none-any.whl'
(Pdb) re.match(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))", link.filename)
<re.Match object; span=(0, 11), match='log_setup-1'>
As you can see from the pdb session above, it only matches log_setup-1
not log_setup-14
or log_setup-14.0.0
.
Activity
edwardgeorge commentedon Jan 22, 2020
Fixed by #1932
github-actions commentedon Mar 3, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.