Skip to content

Python requirement of package completely ignored by poetry #5591

@onnoeberhard

Description

@onnoeberhard
  • 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 12.3.1
  • Poetry version: 1.1.13
  • Link of a Gist with the contents of your pyproject.toml file: (contents pasted below)

Issue

I created a completely empty folder with the following pyproject.toml file:

[tool.poetry]
name = "abcd"
version = "0.1.0"
description = ""
authors = ["Onno Eberhard <onnoeberhard@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.dev-dependencies]
dm-control = {version = "^1.0.2", python = ">=3.9,<=3.10"}

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

Running poetry update yields the following error message:

Updating dependencies
Resolving dependencies... (0.0s)

  SolverProblemError

  The current project's Python requirement (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:
    - dm-control requires Python >=3.7, <=3.10, so it will not be satisfied for Python >3.10,<4.0

  Because no versions of dm-control match >1.0.2,<2.0.0
   and dm-control (1.0.2) requires Python >=3.7, <=3.10, dm-control is forbidden.
  So, because abcd depends on dm-control (^1.0.2), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For dm-control, a possible solution would be to set the `python` property to ">=3.9,<=3.10"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

The suggestion is to "set the python property to ">=3.9,<=3.10"", which I have done. I can only conclude that poetry completely ignores this property.

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