question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PEP 440 version matching of local version identifier clause (e.g. 1.2.3+local) not implemented correctly in solver

See original GitHub issue
  • 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: Windows 10, but also in a Linux docker container running Ubuntu 18.04

  • Poetry version: 1.0.9

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/Korijn/b88b1605221574f51ee72b75efc03dbe

Issue

In PEP 440, it says the following in the section “Version Matching”:

If the specified version identifier is a public version identifier (no local version label), then the local version label of any candidate versions MUST be ignored when matching versions.

I believe this clause is being interpreted incorrectly by Poetry. When running poetry lock on a pyproject.toml file (see the gist linked above) with the folowing lines, poetry incorrectly reports a conflict:

torch = "1.4.0+cpu"
torchvision = "0.5.0+cpu"
   1: conflict: torchvision (0.5.0+cpu) depends on torch (1.4.0)
   1: ! not torch (1.4.0) is satisfied by torch (1.4.0+cpu)
   1: ! which is caused by "bla depends on torch (1.4.0+cpu)"
   1: ! thus: torchvision is forbidden
   1: ! torchvision (0.5.0+cpu) is satisfied by torchvision (0.5.0+cpu)
   1: ! which is caused by "bla depends on torchvision (0.5.0+cpu)"
   1: ! thus: version solving failed

As said in the first line of the debug output, the package torchvision (0.5.0+cpu) depends on torch (1.4.0). However, I’ve specified that I need torch (1.4.0+cpu). The PEP says that the local identifier MUST be ignored when performing the version match for the constraint coming from the torchvision (0.5.0+cpu) package. So I would say that this conflict is actually an acceptable solution, given the constraints.

Note that Pip has no problem installing this combination of packages.

This is an issue with Poetry’s solver.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:26
  • Comments:27 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
xvr-hltcommented, Aug 30, 2021

Any updates? This is currently blocking us from rolling out Poetry to any of our projects that use torch.

7reactions
hhoeflincommented, Nov 4, 2020

Is there any update on this? It is a real problem for my projects where I rely on torch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 440 – Version Identification and Dependency Specification
This PEP describes a scheme for identifying versions of Python software ... The use of a local version identifier does not affect the...
Read more >
Version loaded from file does not comply with PEP 440
I ran python setup.py --version and showed the correct version in the file. I changed the version and ran again and it was...
Read more >
Town o~Newfahe~ Local Waterfront Revitalization ~togra
Newfane Town Board ~dopting the Town of Newfane Local Waterfront ... SECTION 5: TECHNIQUES FOR LOCAL IMPLEMENTATION OF THE LWRP.
Read more >
Interventions to improve the labour market outcomes of youth
The youth employment challenge is not only about job creation, but especially about enhancing the quality of jobs for youth.
Read more >
air force cadet wing instruction 36-3501
Violations of this instruction may be punishable under the Uniform Code of Military Justice (UCMJ). (including, but not limited to, Article 92) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found