-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poetry add "requests[security]" fails on Poetry 1.2.0b1 #5727
Comments
Hello @thailow, I guess your project itself is named Naming the project the same as a dependency is not allowed. fin swimmer |
Hi @finswimmer, the project has a different name. I am pretty sure this is a bug as it's working fine in 1.1.13. |
Hey, then please show your fin swimmer |
Sure, here it is: [tool.poetry]
name = "cross_piano_client"
version = "0.1.27"
description = ""
authors = ["Full Name <[email protected]>"]
[tool.poetry.dependencies]
python = "3.9.13"
dependency-injector = "^4.38.0"
deprecated = "^1.2.13"
requests = {extras = ["security"], version = "^2.27.1"}
[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[[tool.poetry.source]]
name = "gitlab_shared"
url = "https://gitlab.com/api/v4/groups/1241251/-/packages/pypi/simple" |
|
I just retested as well - you should be able to reproduce with these steps:
|
Still all works fine for me... Hard to know what to suggest in that case, maybe clear out your cache and see if that helps? |
Strange.. I am managing the .venv in the projects (virtualenvs.in-project = true), hence, should not rely too much on any cache. Is it possible that there is some interference with pyenv? There is some other issue which I always face (and I do not know it this may be related as well). When I do a By the way, I am on a Mac with M1 Max processor. |
afaik the way that you create your virtual environment has nothing to do with poetry's cache. |
I have the same problem, just with stack trace Stack trace:
17 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/application.py:330 in run
328│
329│ try:
→ 330│ exit_code = self._run(io)
331│ except Exception as e:
332│ if not self._catch_exceptions:
16 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/application.py:174 in _run
172│ self._load_plugins(io)
173│
→ 174│ return super()._run(io)
175│
176│ def _configure_io(self, io: IO) -> None:
15 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/application.py:425 in _run
423│ io.set_input(ArgvInput(argv))
424│
→ 425│ exit_code = self._run_command(command, io)
426│ self._running_command = None
427│
14 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/application.py:467 in _run_command
465│
466│ if error is not None:
→ 467│ raise error
468│
469│ return event.exit_code
13 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/application.py:451 in _run_command
449│
450│ if event.command_should_run():
→ 451│ exit_code = command.run(io)
452│ else:
453│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
12 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/commands/base_command.py:118 in run
116│ io.input.validate()
117│
→ 118│ status_code = self.execute(io)
119│
120│ if status_code is None:
11 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/commands/command.py:85 in execute
83│
84│ try:
→ 85│ return self.handle()
86│ except KeyboardInterrupt:
87│ return 1
10 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/update.py:51 in handle
49│ self._installer.update(True)
50│
→ 51│ return self._installer.run()
52│
9 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/installer.py:114 in run
112│ local_repo = Repository()
113│
→ 114│ return self._do_install(local_repo)
115│
116│ def dry_run(self, dry_run: bool = True) -> Installer:
8 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/installer.py:325 in _do_install
323│
324│ with solver.use_environment(self._env):
→ 325│ ops = solver.solve(use_latest=self._whitelist).calculate_operations(
326│ with_uninstalls=self._requires_synchronization,
327│ synchronize=self._requires_synchronization,
7 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:74 in solve
72│ with self._provider.progress():
73│ start = time.time()
→ 74│ packages, depths = self._solve(use_latest=use_latest)
75│ end = time.time()
76│
6 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:133 in _solve
131│
132│ try:
→ 133│ result = resolve_version(
134│ self._package, self._provider, locked=locked, use_latest=use_latest
135│ )
5 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/__init__.py:24 in resolve_version
22│ solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
23│
→ 24│ return solver.solve()
25│
4 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:81 in solve
79│ while next is not None:
80│ self._propagate(next)
→ 81│ next = self._choose_package_version()
82│
83│ return self._result()
3 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:397 in _choose_package_version
395│
396│ conflict = False
→ 397│ for incompatibility in self._provider.incompatibilities_for(package):
398│ self._add_incompatibility(incompatibility)
399│
2 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/provider.py:433 in incompatibilities_for
431│ dependencies.append(dep)
432│
→ 433│ return [
434│ Incompatibility(
435│ [Term(package.to_dependency(), True), Term(dep, False)],
1 ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/provider.py:434 in <listcomp>
432│
433│ return [
→ 434│ Incompatibility(
435│ [Term(package.to_dependency(), True), Term(dep, False)],
436│ DependencyCause(),
AssertionError
Package 'coverage' is listed as a dependency of itself.
at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/incompatibility.py:61 in __init__
57│ # incompatibility irrelevant, since we already know that mutually
58│ # exclusive version ranges are incompatible. We should never derive
59│ # an irrelevant incompatibility.
60│ err_msg = f"Package '{ref}' is listed as a dependency of itself."
→ 61│ assert by_ref[ref] is not None, err_msg
62│ else:
63│ by_ref[ref] = term
64│
65│ new_terms = [] |
I tried adding requests = {extras = ["security"], version = "^2.27.1"}
black = {extras = ["jupyter"], version = "^22.3.0"}
coverage = "^6.4" console log:
$ poetry add 'requests[security]'
Using version ^2.27.1 for requests
Updating dependencies
Resolving dependencies... (0.2s)
Writing lock file
Package operations: 5 installs, 0 updates, 0 removals
• Installing certifi (2022.5.18.1)
• Installing charset-normalizer (2.0.12)
• Installing idna (3.3)
• Installing urllib3 (1.26.9)
• Installing requests (2.27.1)
$ poetry add 'black[jupyter]'
Using version ^22.3.0 for black
Updating dependencies
Resolving dependencies... (1.8s)
Writing lock file
Package operations: 20 installs, 1 update, 0 removals
• Installing parso (0.8.3)
• Installing ptyprocess (0.7.0)
• Installing traitlets (5.2.2.post1)
• Installing wcwidth (0.2.5)
• Installing backcall (0.2.0)
• Installing decorator (5.1.1)
• Installing jedi (0.18.1)
• Installing matplotlib-inline (0.1.3)
• Installing pexpect (4.8.0)
• Installing pickleshare (0.7.5)
• Installing prompt-toolkit (3.0.29)
• Installing pygments (2.12.0)
• Updating setuptools (62.1.0 -> 62.3.2)
• Installing click (8.1.3)
• Installing ipython (7.34.0)
• Installing mypy-extensions (0.4.3)
• Installing pathspec (0.9.0)
• Installing platformdirs (2.5.2)
• Installing tokenize-rt (4.2.1)
• Installing tomli (2.0.1)
• Installing black (22.3.0)
$ poetry add coverage
Using version ^6.4 for coverage
Updating dependencies
Resolving dependencies... (0.2s)
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
• Installing coverage (6.4) Install Poetry from VCSpipx install --force --suffix=@git 'poetry @ git+https://github.com/python-poetry/poetry.git' |
If you are still experiencing the issue with the code on master, I'd recommend you do the following.
Note: |
It seems to be related to private repos. pyproject.toml[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"
[[tool.poetry.source]]
name = "devpi"
url = "https://<devpi mirror>"
default = true
[tool.poetry.dependencies]
python = "^3.9"
google-cloud-pubsub = "^2.12.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api" poetry install --no-cache -vvv
Without a mirror works just fine
Locking works correctly, it's installation that fails. Everything above was done using the latest master installed through |
I'm also encountering this issue. Locking seems to work 'fine' in that that operation does not produce any runtime errors due to solving. Master (89e3f7b) produced this lock file section:
So locking produces an incorrect result which is only noticed when installing. |
Seems to be broken starting from |
Oh. Maybe it's in locking after al. With version that works for a project without a lock file (i.e. the example above) I've tried to install another project with lock generated using latest master and it failed. After regenerating lock it installs correctly. |
poetry/src/poetry/puzzle/solver.py Lines 166 to 173 in 89e3f7b
I think that needs to become (seems to work for me) if (
not _package.features
and package.provides(_package)
and _package.version == package.version
):
for dep in package.requires:
# Prevent adding base package as a dependency to itself
if _package.provides(dep):
continue
Since that if is inside another if that tests whether it has features or not |
I have also hit this issue when using the gitlab pypi registry and testing poetry==1.2.0b1, the issue does not occur with poetry==1.1.13 |
@Agalin @Darsstar Thanks for the analysis. That sounds very plausible to me. @Darsstar Your comment in the release issue sounds like you're already working on a PR with a fix and a test? (I'm looking forward to it.) |
… are involved (#5769) * Add Failing test for #5727 * Fixes #5727 Co-authored-by: Dos Moonen <[email protected]>
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
If I run
poetry add "requests[security]"
on Poetry 1.2.0b1, it fails with this message:Package 'requests' is listed as a dependency of itself.
I downgraded to Poetry 1.1.13 where it works. Thanks for all your work!
The text was updated successfully, but these errors were encountered: