Skip to content

Dataclasses solver failure with conditional python marker #2386

@mands

Description

@mands
  • 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).

  • Linux (Fedora 32):

  • Poetry version:

$ poetry debug info

Poetry
Version: 1.0.5
Python:  3.8.2

Virtualenv
Python:         3.8.2
Implementation: CPython
Path:           /home/projects/poetry-dataclasses/poetry-demo/.venv
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr

pyproject.yaml

[tool.poetry]
name = "poetry-demo"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.6.1"
dataclasses = {version = "^0.7", python = "~3.6.1"}
dacite = "^1.5.0"

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

Issue

Following on from #1413, the solution there seems to suggest user python version markers to specify when to install a conditional dependencty - in my case the dataclasses-backport on python 3.6.*. However this seems to result in a SolverProblemError resolving in certain cases even with the python specifier as indicated in my pyproject.yaml above .

Things seem to work fine until I also install the addional library dacite (https://github.com/konradhalas/dacite) - which also has a dependency on dataclasses when using python 3.6. The setup.py for it is as follows,

    install_requires=['dataclasses;python_version<"3.7"'],

Once this library is also installed, adding any other packages to my project results in the aforementioned SolverProblemError, e.g.

$ poetry add arrow
Using version ^0.15.6 for arrow

Updating dependencies
Resolving dependencies... (0.0s)

[SolverProblemError]
The current project's Python requirement (^3.6.1) is not compatible with some of the required packages Python requirement:
  - dataclasses requires Python >=3.6, <3.7

Because dataclasses (0.7) requires Python >=3.6, <3.7
 and no versions of dataclasses match >0.7,<0.8, dataclasses is forbidden.
So, because poetry-demo depends on dataclasses (^0.7), version solving failed.

Commenting then uncommenting out either my use of dataclasses or dacite in my pyproject.toml to add additional libraries works, but it seems that both my projects and dacite's use of dataclasses with a conditional python marker conflict in poetry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions