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.

Version Resolution failure

See original GitHub issue
  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  • pdm init
  • pdm add packages
  • pdm add other_packages => InconsistentCandidate error

If I do pdm add packages other_packages it works.

I guess the resolution of depencies is made in the second case but fail in the first one…

Actual behavior

Get an InconsistentCandidate error when adding by steps (but works if adding a bunch).

Also (maybe not related) but sklearn got a version of ~=0.0 which seems to works but seems weird.

Expected behavior

Install packages normally like with pip.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:        1.6.2                                     
Python Interpreter: /usr/bin/python (3.9)                     
Project Root:       /mnt/Projets/python-nlu                   
Project Packages:   /mnt/Projets/python-nlu/__pypackages__/3.9
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.5",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.12.9-arch1-1",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT Thu, 03 Jun 2021 11:36:13 +0000",
  "python_full_version": "3.9.5",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}

Thanks in advance,

Have a great day

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

4reactions
frostmingcommented, Jun 21, 2021

For your final question, --unconstrained controls whether the specifiers in pyproject.toml should change, not what versions should be pinned which is locked in pdm.lock. And if my previous comment gives you the wrong impression, correct me now.

Say you have following content in pyproject.toml:

[project]
dependencies = [
    "urllib3<1.26"
]

And urllib3==1.25.1 is pinned in pdm.lock. Assume the latest version of urllib3 is 1.25.6 and when you do pdm add --unconstrained requests:

  1. Due to the effect of --unconstrained, <1.26 is stripped from the requirement, now the requirements are like ["urllib3", "requests"].
  2. The requirements are then fed into the resolver to get a resolution. The resolver finds that the latest version of requests requires urllib3>=1.25.0.
  3. Due to the effect of the default update strategy(reuse), the pinned version of urllib3==1.25.1 gets reused as it satisfies the version constraint >=1.25.0.
  4. So the pinned version of urllib3 in pdm.lock is unchanged.
  5. Due to the effect of the default version-save strategy(compatible), PDM updates the requirement string of urllib3 pyproject.toml as urllib3~=1.25.
  6. Now the pyproject.toml looks like:
    [project]
    dependencies = [
        "urllib3~=1.25",
        "requests~=2.25",
    ]
    
    And the urllib3 version installed is kept untouched.

Note that the default strategies in step 3 and 5 can be overridden by CLI options, see how to do it by pdm add --help.

2reactions
frostmingcommented, Jun 18, 2021

@lazarillo Not exactly

pdm add --unconstrained requests will relax the version constraints of existing packages to make it possible to pick another version that is compatible with the newly added package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package resolution failed. Couldn'… | Apple Developer Forums
Can't add any dependency via SPM and always see this error (for example, SnapKit):. Clean derived data, reset package caches, resolve package version, ......
Read more >
Dependencies resolution issue: unstable-version reported ...
The resolution of the graph fails with this error: Dependencies could not be resolved because root depends on 'Internal-2' 1.2.3..<2.0.0.
Read more >
Understanding dependency resolution - Gradle User Manual
If there is no version available for the highest range, the resolution will fail. If a version declared as strictly is lower than...
Read more >
Dependency Resolution - pip documentation v22.3.1
The process of determining which version of a dependency to install is known as dependency resolution. This behaviour can be disabled by passing...
Read more >
NuGet Package Dependency Resolution - Microsoft Learn
When an application specifies an exact version number, such as 1.2, that is not available on the feed, NuGet fails with an error...
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