Skip to content

Dependency resolution takes hours for multiple python version markers #4670

@rootcss

Description

@rootcss
  • 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 Big Sur 11.4
  • Poetry version: 1.1.11

Issue

My project requires to use multiple python versions. Some of the packages are not compatible for both of those python versions, for which I'm using multiple-constraints-dependencies as shown below. Without this, the poetry lock --no-update -vvv command took just 10 seconds. However, after adding this it takes forever to run the dependency resolution. Below is the pyproject.toml file.

[tool.poetry]
name = "some-service"
version = "0.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = "3.6.10 || 3.9.5"
numpy = "1.19.3"
dropbox = [
    {version = "7.1.0", python = "3.6.10"},
    {version = "9.5.0", python = "3.9.5"}
]
gevent = [
    {version = "1.2.2", python = "3.6.10"},
    {version = "21.1.2", python = "3.9.5"}
]
guppy3 = [
    {version = "3.0.9", python = "3.6.10"},
    {version = "3.1.1", python = "3.9.5"}
]
Markdown = [
    {version = "2.6.6", python = "3.6.10"},
    {version = "3.3.4", python = "3.9.5"}
]
pexpect = [
    {version = "4.1.0", python = "3.6.10"},
    {version = "4.8.0", python = "3.9.5"}
]
scikit-learn = [
    {version = "0.20.4", python = "3.6.10"},
    {version = "0.24.2", python = "3.9.5"}
]
scipy = [
    {version = "1.5.4", python = "3.6.10"},
    {version = "1.7.1", python = "3.9.5"}
]
psycopg2 = [
    {version = "2.7.3.2", python = "3.6.10"},
    {version = "2.9.1", python = "3.9.5"}
]

[tool.poetry.dev-dependencies]
coverage = "4.4.1"

I observed that the time for resolution keeps increasing as the number of constraints increase. I'm suspecting it builds and resolves multiple dependency trees, causing it to take so long. In the logs, I saw it performed 510 overrides: 0: Complete version solving took 256.095 seconds with 510 overrides which seem to be permutations of above-mentioned constraints.

Is this expected behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/solverRelated to the dependency resolverkind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions