Poetry: SolverProblemError with papermill

Created on 17 Aug 2020  Â·  6Comments  Â·  Source: python-poetry/poetry

Information

  • [x] I am on the latest Poetry version.
  • [x] 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: Ubuntu 18 LTS

  • Poetry version: 1.0.10 (and 1.0.5, too)
  • Link of a Gist with the contents of your pyproject.toml file: Not required

Issue

When installing papermill with poetry i got the following error message:

[SolverProblemError]
Because no versions of papermill match >2.1.2,<3.0.0
 and papermill (2.1.2) depends on black (*), papermill (>=2.1.2,<3.0.0) requires black (*).
So, because no versions of black match *
 and **myframework** on papermill (^2.1.2), version solving failed.

It looks like it failed to find any version of black, which is weird.

workaround

I just installed black by hand and papermill after that with:

poetry add black
poetry add papermill

This resolved my issue but I leave it here for the poetry devs and other users running into this issue

Bug Dependency resolution

Most helpful comment

The root cause here is that when provided black (*) as a dependency; since black only has pre-release versions, no version was detected when resolving for dependencies of paparmill. I have attempted to fix it by modifying currrent behaviour such that such packages fallback to returning pre-release versions if constraint is (*). Alternative fix might be in poetry-core where a dependency that uses an any constraint is enabled to allow pre-release. The latter might have undesired side-effects.

All 6 comments

@AssassinTee can you try the latest release (1.0.10) or pre-release (1.1.0b2) please? This seems to be resolved.

$ poetry --version
Poetry version 1.0.10
$ poetry add black
Using version ^19.10b0 for black

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file


Package operations: 8 installs, 0 updates, 0 removals

  - Installing appdirs (1.4.4)
  - Installing attrs (19.3.0)
  - Installing click (7.1.2)
  - Installing pathspec (0.8.0)
  - Installing regex (2020.7.14)
  - Installing toml (0.10.1)
  - Installing typed-ast (1.4.1)
  - Installing black (19.10b0)
$ poetry add papermill
Using version ^2.1.2 for papermill

Updating dependencies
Resolving dependencies... (0.4s)

Writing lock file


Package operations: 27 installs, 0 updates, 0 removals

  - Installing decorator (4.4.2)
  - Installing ipython-genutils (0.2.0)
  - Installing six (1.15.0)
  - Installing pyrsistent (0.16.0)
  - Installing traitlets (4.3.3)
  - Installing jsonschema (3.2.0)
  - Installing jupyter-core (4.6.3)
  - Installing python-dateutil (2.8.1)
  - Installing pyzmq (19.0.2)
  - Installing tornado (6.0.4)
  - Installing async-generator (1.10)
  - Installing certifi (2020.6.20)
  - Installing chardet (3.0.4)
  - Installing idna (2.10)
  - Installing jupyter-client (6.1.6)
  - Installing nbformat (5.0.7)
  - Installing nest-asyncio (1.4.0)
  - Installing textwrap3 (0.9.2)
  - Installing urllib3 (1.25.10)
  - Installing ansiwrap (0.8.4)
  - Installing entrypoints (0.3)
  - Installing nbclient (0.4.1)
  - Installing pyyaml (5.3.1)
  - Installing requests (2.24.0)
  - Installing tenacity (6.2.0)
  - Installing tqdm (4.48.2)
  - Installing papermill (2.1.2)

I updated poetry with poetry update self to version 1.0.10 and opened a new clean conda environment, only installing papermill with poetry add papermill still leads to the error:

[SolverProblemError]
Because no versions of papermill match >2.1.2,<3.0.0
 and papermill (2.1.2) depends on black (*), papermill (>=2.1.2,<3.0.0) requires black (*).
So, because no versions of black match *
 and poetrydemo depends on papermill (^2.1.2), version solving failed.

(testenv) user@kraft-Precision-5530:~/workspace/testdir/poetrydemo$ poetry --version
Poetry version 1.0.10
(testenv) user@kraft-Precision-5530:~/workspace/testdir/poetrydemo$ poetry add papermill
Using version ^2.1.2 for papermill

Updating dependencies
Resolving dependencies... (0.0s)

[SolverProblemError]
Because no versions of papermill match >2.1.2,<3.0.0
 and papermill (2.1.2) depends on black (*), papermill (>=2.1.2,<3.0.0) requires black (*).
So, because no versions of black match *
 and poetrydemo depends on papermill (^2.1.2), version solving failed.
(testenv) user@kraft-Precision-5530:~/workspace/testdir/poetrydemo$ 

Same with the beta:

(testenv) user@kraft-Precision-5530:~/workspace/testdir/poetrydemo$ poetry self update --preview
Updating to 1.1.0b2
 - Downloading poetry-1.1.0b2-linux.tar.gz 100%

Poetry (1.1.0b2) is installed now. Great!
(testenv) user@kraft-Precision-5530:~/workspace/testdir/poetrydemo$ poetry --version
Poetry version 1.1.0b2
(testenv) user@kraft-Precision-5530:~/workspace/testdir/poetrydemo$ poetry add papermill
Using version ^2.1.2 for papermill

Updating dependencies
Resolving dependencies... (0.0s)

  SolverProblemError

  Because no versions of papermill match >2.1.2,<3.0.0
   and papermill (2.1.2) depends on black (*), papermill (>=2.1.2,<3.0.0) requires black (*).
  So, because no versions of black match *
   and poetrydemo depends on papermill (^2.1.2), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:222 in _solve
      218│             packages = result.packages
      219│         except OverrideNeeded as e:
      220│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      221│         except SolveFailure as e:
    → 222│             raise SolverProblemError(e)
      223│ 
      224│         graph = self._build_graph(self._package, packages)
      225│ 
      226│         depths = []

@AssassinTee whats the python dependency for your project? And what is your python runtime version?

I am currently using python 3.7.7 and was able to create the issue with a clean conda environment (without other dependencies). The poetry project itself uses python="^3.7"

pyproject.toml for completion:

[tool.poetry]
name = "poetrydemo"
version = "0.1.0"
description = ""
authors = ["yes"]

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

[tool.poetry.dev-dependencies]
pytest = "^5.2"

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

Thanks for that. I can reproduce the issue now using:

poetry add --dry-run papermill

I was installing black before papermill; missed the part you said about it being the workaround :)

The root cause here is that when provided black (*) as a dependency; since black only has pre-release versions, no version was detected when resolving for dependencies of paparmill. I have attempted to fix it by modifying currrent behaviour such that such packages fallback to returning pre-release versions if constraint is (*). Alternative fix might be in poetry-core where a dependency that uses an any constraint is enabled to allow pre-release. The latter might have undesired side-effects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EdgyEdgemond picture EdgyEdgemond  Â·  3Comments

AWegnerGitHub picture AWegnerGitHub  Â·  3Comments

jeremy886 picture jeremy886  Â·  3Comments

nikaro picture nikaro  Â·  3Comments

Euphorbium picture Euphorbium  Â·  3Comments