Poetry unable to resolve dependency using asterisk wildcard (*)
See original GitHub issue-
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: Arch Linux
-
Poetry version: 1.0.9
-
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/matthewarmand/a281ea411867253662008becfe38aeab
Issue
I’m noticing an issue with using a wildcard (*
) for a version specification for a dependency in pyproject.toml
. In this new project, I’m adding a dev dependency of black
for code formatting. Generally I prefer to allow any version for this, so I’m attempting to use the wildcard syntax (docs). The docs seem to indicate that my example gist above should work, but poetry is having trouble resolving the dependency.
In searching for other issues, this seems similar to #1281, though that’s an older issue. I tried the mitigation steps at the end of that issue (deleting poetry.lock
, etc) but it does not seem to help this case. I also noticed #2626, and I’m wondering if this is somehow related to that issue, perhaps a side effect. Opened this one separately though in case its a different issue.
Sample commands and output
When I try to do this via manual modification of pyproject.toml
and using poetry install -vvv
, I see the following output:
Using virtualenv: /home/matt/.cache/pypoetry/virtualenvs/example-k3bGbc8x-py3.8
Updating dependencies
Resolving dependencies...
1: fact: example is 0.1.0
1: derived: example
1: fact: example depends on django (~2.2)
1: fact: example depends on black (*)
1: fact: example depends on black (*)
1: selecting example (0.1.0)
1: derived: black (*)
1: derived: django (~2.2)
1: fact: no versions of black match *
1: conflict: no versions of black match *
1: ! black (*) is satisfied by black (*)
1: ! which is caused by "example depends on black (*)"
1: ! thus: version solving failed
1: Version solving took 0.017 seconds.
1: Tried 1 solutions.
[SolverProblemError]
Because example depends on black (*) which doesn't match any versions, version solving failed.
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/usr/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/usr/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/usr/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/usr/lib/python3.8/site-packages/poetry/console/commands/install.py", line 69, in handle
return_code = installer.run()
File "/usr/lib/python3.8/site-packages/poetry/installation/installer.py", line 74, in run
self._do_install(local_repo)
File "/usr/lib/python3.8/site-packages/poetry/installation/installer.py", line 161, in _do_install
ops = solver.solve(use_latest=self._whitelist)
File "/usr/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 36, in solve
packages, depths = self._solve(use_latest=use_latest)
File "/usr/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 190, in _solve
raise SolverProblemError(e)
Alternatively, I also attempted to let poetry
add the dependency using poetry add --dev -vvv black="*"
. The PyPI
lines below seem particularly suspect, so maybe this is related to poetry
’s PyPI
interaction in the wildcard case. In this case, I see the following output:
Using virtualenv: /home/matt/.cache/pypoetry/virtualenvs/example-k3bGbc8x-py3.8
PyPI: 20 packages found for black *
Updating dependencies
Resolving dependencies...
1: fact: example is 0.1.0
1: derived: example
1: fact: example depends on django (~2.2)
1: fact: example depends on black (*)
1: fact: example depends on black (*)
1: selecting example (0.1.0)
1: derived: black (*)
1: derived: django (~2.2)
PyPI: No release information found for django-1.0.1, skipping
PyPI: No release information found for django-1.0.2, skipping
PyPI: No release information found for django-1.0.3, skipping
PyPI: No release information found for django-1.0.4, skipping
PyPI: No release information found for django-1.1, skipping
PyPI: No release information found for django-1.1.1, skipping
PyPI: No release information found for django-1.1.2, skipping
PyPI: 15 packages found for django >=2.2,<2.3
PyPI: 0 packages found for black *
1: fact: no versions of black match *
1: conflict: no versions of black match *
1: ! black (*) is satisfied by black (*)
1: ! which is caused by "example depends on black (*)"
1: ! thus: version solving failed
1: Version solving took 0.018 seconds.
1: Tried 1 solutions.
[SolverProblemError]
Because example depends on black (*) which doesn't match any versions, version solving failed.
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/usr/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/usr/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/usr/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/usr/lib/python3.8/site-packages/poetry/console/commands/add.py", line 149, in handle
status = installer.run()
File "/usr/lib/python3.8/site-packages/poetry/installation/installer.py", line 74, in run
self._do_install(local_repo)
File "/usr/lib/python3.8/site-packages/poetry/installation/installer.py", line 161, in _do_install
ops = solver.solve(use_latest=self._whitelist)
File "/usr/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 36, in solve
packages, depths = self._solve(use_latest=use_latest)
File "/usr/lib/python3.8/site-packages/poetry/puzzle/solver.py", line 190, in _solve
raise SolverProblemError(e)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:8 (1 by maintainers)
Probably yeah. I’d just left it open until a maintainer popped in but that hasn’t happened, and since it seems to have been incidentally fixed as of
1.1.x
, seems it can be closed.Looks like I was just on an old version (thought I had updated to the latest but clearly not). So this bug can be closed?