Skip to content

Conflicting dependencies even if dependency group is not installed #6611

@Cito

Description

@Cito
  • Poetry version: 1.2.1
  • Python version: 3.9.13
  • OS version and name: Windows 10
  • pyproject.toml:
[tool.poetry.group.lint]
optional = true

[tool.poetry.group.lint.dependencies]
flake8 = "^5.0"

[tool.poetry.group.doc]
optional = true

[tool.poetry.group.doc.dependencies]
sphinx = "^5.1"
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Since the current versions of Flake8 and Sphinx have conflicting dependencies, I have put these into separate, optional dependency groups. But no matter how I install (without one of the dependency groups or without both of them, running a simpe poetry install), I still get the error message because my-project depends on both flake8 (^5.0) and sphinx (^5.1), version solving failed. Shouldn't the optional dependency groups avoid such kinds of problems?

In the debug log I see

  1: fact: my-project depends on flake8 (^5.0)        
  1: fact: my-project depends on sphinx (^5.1)        

So it seems Poetry thinks that my project depends on both flake8 and sphinx, but it only optionally depends on them, and it should only give an error if both groups are installed at the same time, i.e. with lint,doc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/questionUser questions (candidates for conversion to discussion)status/duplicateDuplicate issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions