Skip to content

Dependency (pytype) rejected for project supporting Python 3.6+ even though compatible #2076

@cjolowicz

Description

@cjolowicz

Poetry's solver rejects installation of pytype in a project supporting Python 3.6+, even though pytype's Python constraint is compatible with it.

Repro:

  1. Add the following pyproject.toml
[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
authors = ["User <[email protected]>"]

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

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
  1. Run poetry add --dev --python="<3.8" pytype

This results in the following error message:

Creating virtualenv poetry-pytype-VZF4hhnk-py3.7 in ~/Library/Caches/pypoetry/virtualenvs
Using version ^2020.2.20 for pytype

Updating dependencies
Resolving dependencies... (0.0s)

[SolverProblemError]
The current project's Python requirement (^3.6) is not compatible with some of the required packages Python requirement:
  - pytype requires Python !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<3.8,>=2.7

Because no versions of pytype match >2020.2.20,<2021.0.0
 and pytype (2020.2.20) requires Python !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<3.8,>=2.7, pytype is forbidden.
So, because poetry-pytype depends on pytype (^2020.2.20), version solving failed.

The same error happens with the command poetry add --dev pytype. (The --python="<3.8" was added because pytype currently does not support Python 3.8.)

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