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.

Multiple constraints on same package cause O(exp(N)) checks

See original GitHub issue
poetry init -n
poetry add -vvv numpy ipython jupyter opencv-python notebook pandas django~3.2

Runs very long dependency resolution.

Problem is that it does a lot of override attempts (why?). 0: Retrying dependency resolution with the following overrides ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}).

including weird ones like 0: Retrying dependency resolution with the following overrides ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}}).

52 override checks for this case, so, if you now have several additional slow loading packages, e.g. each override checking would take 20 seconds, you’ll get 20 * 52 = 520 seconds to install.

0: Complete version solving took 13.010 seconds with 52 overrides 0: Resolved with overrides: ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (>=3.10.0.0)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.21.0)>}, Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('black', '21.12b0'): {'typing-extensions': <Dependency typing-extensions (!=3.10.0.1)>}})

In more complicated cases it will be:

0: Duplicate dependencies for numpy 0: Different requirements found for numpy (>=1.18.5) with markers platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10", numpy (>=1.19.2) with markers platform_machine == "aarch64" and python_version < "3.10" and numpy (>=1.20.0) with markers platform_machine == "arm64" and python_version < "3.10". and 0: Complete version solving took 115.009 seconds with 16 overrides 0: Resolved with overrides: ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.21.2)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.19.3)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.14.5)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}), ({Package('opencv-python', '4.5.5.62'): {'numpy': <Dependency numpy (>=1.17.3)>}, Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}})

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

16reactions
jamespacileocommented, May 8, 2022

Alternative fix… keep Python to ^3.7…

and set pandas to ~1.3

Versions of Pandas of 1.4 onwards don’t support Python 3.7… and lead you into the poetry dependency resolution black hole where time ends and nothing makes sense anymore.

For I got lost in the depths of the abyss and emerged to tell the tale… shall these words spread, inform and aid other unsuspecting travellers.

The abyss is there. Shrouded. Waiting for its next victim.

2reactions
alimanfoocommented, Jul 21, 2022

Hi all, just to share I seem to have found a way out of this abyss that allows supporting multiple Python versions from 3.7 to 3.9 at least.

In pyproject.toml I have:

[tool.poetry.dependencies]
python = ">=3.7.1,<3.10"
numpy = "*"
pandas = [
    {version="<1.4", python=">=3.7.1,<3.8"},
    {version="*", python=">=3.8,<3.10"}
]

This also only seems to work with poetry 1.2.0b3, not poetry 1.1 (which seems to omit including hashes for alternate pandas versions in the lock file).

Read more comments on GitHub >

github_iconTop Results From Across the Web

DUPLICATE SYS Constraints - Ask TOM
The above is the reason why. Every time they copied the data, they added yet another bunch of check constraints, all doing the...
Read more >
Checks | Staticcheck
Explanations for all checks in Staticcheck. ... SA4019, Multiple, identical build constraints in the same file. SA4020, Unreachable case clause in a type ......
Read more >
Certify Constraints — CRDS 11.16.16 documentation
The .tpn constraints define many of the checks CRDS applies to rule or reference files. ... There are two forms of .tpn, one...
Read more >
Constraint-Satisfaction Problems in Python - Manning
To solve the problem, we need a constraint that checks whether any two queens are on the same row or diagonal (they were...
Read more >
Constraints — ASE documentation - CAMD Wiki pages
Especially for cases in which more than one bond length constraint is applied ... Apply RATTLE-type bond constraints between outer atoms n and...
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