Poetry: When having a git dependency, Poetry fails with SolverProblemError while trying to run $ poetry install twice

Created on 6 Sep 2019  路  5Comments  路  Source: python-poetry/poetry

  • [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.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Debian Booster; Windows 10
  • Poetry version: 1.0.0b1 as installed by pip for python 3.8.0b4; 0.12.17
  • Link of a Gist with the contents of your pyproject.toml file: link

Issue

Run

$ poetry new a
$ cd a
$ vim pyproject.toml

Add a single dependency like this:

attrs = { git = "https://github.com/python-attrs/attrs.git", rev = "daf2bc8182a681ed0c85271bafbd24c2ca5ea70b" }

Run $ poetry install. Observe that correct version of attrs is installed

- Installing attrs (19.2.0.dev0 daf2bc8)

Run the same command again: $ poetry install. Observe that Poetry fails with:

[SolverProblemError]
Because no versions of pytest match >=3.0,<3.10.1 || >3.10.1,<4.0
 and pytest (3.10.1) depends on attrs (>=17.4.0), pytest (>=3.0,<4.0) requires attrs (>=17.4.0).
So, because no versions of attrs match >=17.4.0
 and b depends on pytest (^3.0), version solving failed.

Same problem manifests itself for this version of attrs as a path dependency. I tested a few other libraries and they don't seem to be affected with the exception of mypy, which i believe is due to #611. #743 is a possibly related issue.

The problem can be mitigated by erasing the virtual environment removing poetry.lock.

Bug

Most helpful comment

@oakkitten It will be fixed in the next beta release which should be out today or tomorrow.

All 5 comments

I looked at what seems to be proposed operations (i think these should be displayed with -vvv?). For 1.0.0b1, the first install and second install yielded, respectively,

[<Install more-itertools (7.2.0)>, <Install zipp (0.6.0)>, <Install importlib-metadata (0.20)>, <Install atomicwrites (1.3.0)>, <Install attrs (19.2.0.dev0 daf2bc8)>, <Install colorama (0.4.1)>, <Install pluggy (0.12.0)>, <Install py (1.8.0)>, <Install six (1.12.0)>, <Install pytest (3.10.1)>]
[<Install atomicwrites (1.3.0)>, <Update attrs (0.0.0 daf2bc8) to attrs (19.2.0.dev0 daf2bc8)>, <Install attrs (19.2.0.dev0 daf2bc8)>, <Install colorama (0.4.1)>, <Install importlib-metadata (0.20)>, <Install more-itertools (7.2.0)>, <Install pluggy (0.12.0)>, <Install py (1.8.0)>, <Install pytest (3.10.1)>, <Install six (1.12.0)>, <Install zipp (0.6.0)>]

The only difference here is different order, as well as this weird part: <Update attrs (0.0.0 daf2bc8) to attrs (19.2.0.dev0 daf2bc8)>.

On other repo with more dependencies and attrs sourcing from path, the working and broken variants were, respectively,

[<Install more-itertools (7.2.0)>, <Install attrs (19.2.0.dev0 external/attrs)>, <Install pycparser (2.19)>, <Install typing (3.7.4.1)>, <Install zipp (0.6.0)>, <Install async-generator (1.10)>, <Install cffi (1.12.3)>, <Install idna (2.8)>, <Install importlib-metadata (0.20)>, <Install mypy-extensions (0.4.1)>, <Install outcome (1.0.0)>, <Install sniffio (1.1.0)>, <Install sortedcontainers (2.1.0)>, <Install typed-ast (1.4.0)>, <Install typing-extensions (3.7.4)>, <Install atomicwrites (1.3.0)>, <Install colorama (0.4.1)>, <Install mypy (0.730+dev.d4151a8397bfba840da4feca1bfea070864f317a external/mypy)>, <Install pluggy (0.12.0)>, <Install py (1.8.0)>, <Install six (1.12.0)>, <Install trio (0.12.1)>, <Install win32-setctime (1.0.1)>, <Install loguru (0.3.2)>, <Install psutil (5.6.3)>, <Install pytest (3.10.1)>, <Install trio-typing (0.2.0)>]
[<Install async-generator (1.10)>, <Install atomicwrites (1.3.0)>, <Install attrs (19.2.0.dev0 external/attrs)>, <Install cffi (1.12.3)>, <Install colorama (0.4.1)>, <Install idna (2.8)>, <Install importlib-metadata (0.20)>, <Install loguru (0.3.2)>, <Install more-itertools (7.2.0)>, <Install mypy (0.730+dev.d4151a8397bfba840da4feca1bfea070864f317a external/mypy)>, <Install mypy-extensions (0.4.1)>, <Install outcome (1.0.0)>, <Install pluggy (0.12.0)>, <Install psutil (5.6.3)>, <Install py (1.8.0)>, <Install pycparser (2.19)>, <Install pytest (3.10.1)>, <Install six (1.12.0)>, <Install sniffio (1.1.0)>, <Install sortedcontainers (2.1.0)>, <Install trio (0.12.1)>, <Install trio-typing (0.2.0)>, <Install typed-ast (1.4.0)>, <Install typing (3.7.4.1)>, <Install typing-extensions (3.7.4)>, <Install win32-setctime (1.0.1)>, <Install zipp (0.6.0)>]

These only differ in order.

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

the code still fails in 1.0.0b4; the error is different, though

oakkitten@piz ~/test/a % poetry -V
Poetry version 1.0.0b4


oakkitten@piz ~/test/a % poetry install -vvv
Using virtualenv: /home/oakkitten/.cache/pypoetry/virtualenvs/a-AmxWI_AM-py3.8
Installing dependencies from lock file

[ValueError]
Invalid git url ""

Traceback (most recent call last):
  File "/home/oakkitten/.poetry/lib/poetry/_vendor/py3.8/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/oakkitten/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/oakkitten/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/oakkitten/.poetry/lib/poetry/_vendor/py3.8/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/oakkitten/.poetry/lib/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/home/oakkitten/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/home/oakkitten/.poetry/lib/poetry/installation/installer.py", line 225, in _do_install
    ops = solver.solve(use_latest=whitelist)
  File "/home/oakkitten/.poetry/lib/poetry/puzzle/solver.py", line 65, in solve
    locked_source_url = Git.normalize_url(locked.source_url)
  File "/home/oakkitten/.poetry/lib/poetry/vcs/git.py", line 131, in normalize_url
    parsed = ParsedUrl.parse(url)
  File "/home/oakkitten/.poetry/lib/poetry/vcs/git.py", line 79, in parse
    raise ValueError('Invalid git url "{}"'.format(url))

@oakkitten It will be fixed in the next beta release which should be out today or tomorrow.

looks like this issue is fixed in 1.0.0b5!

Was this page helpful?
0 / 5 - 0 ratings