Skip to content

Poetry adds conflicting requirements when cases are mixed #6831

@adamchainz

Description

@adamchainz
  • Poetry version: 1.2.2
  • Python version: 3.10.8
  • OS version and name: macOS 12.6
  • pyproject.toml: see below
  • 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

Take this minimal pyproject.toml config for poetry:

[tool.poetry]
name = "example"
version = "0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.10"
Django = "^4.0.8"


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

Then run a command to upgrade Django:

$ poetry add "[email protected]"
Creating virtualenv example-i90kWyrF-py3.10 in /Users/chainz/Library/Caches/pypoetry/virtualenvs

Updating dependencies
Resolving dependencies... (0.5s)

Writing lock file

Package operations: 3 installs, 0 updates, 0 removals

  • Installing asgiref (3.5.2)
  • Installing sqlparse (0.4.3)
  • Installing django (4.1.2)

Poetry adds a second lower-cased dependency on Django to its configuration:

[tool.poetry]
name = "example"
version = "0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.10"
Django = "^4.0.8"
django = "4.1.2"


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

This difference lead to a crash when building a project Docker container:

 > [stage-1  7/18] RUN   poetry config virtualenvs.create false &&   poetry install:
#17 0.749 Skipping virtualenv creation, as specified in config file.
#17 1.881 Installing dependencies from lock file
#17 3.363
#17 3.363 Because example depends on both Django (^4.1.2) and django (4.0.8), version solving failed.

Unfortunately I didn't manage to replicate this crash with poetry install with my minimal example, outside of Docker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/confirmedIssue is reproduced and confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions