Skip to content
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 uninstalls all dependencies when removing any dependency via poetry remove #4632

Closed
3 tasks done
provinzkraut opened this issue Oct 13, 2021 · 5 comments · Fixed by python-poetry/poetry-core#220
Closed
3 tasks done
Assignees
Labels
kind/bug Something isn't working as expected

Comments

@provinzkraut
Copy link

provinzkraut commented Oct 13, 2021

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

Issue

When removing a dependency via poetry remove, poetry will uninstall every dependency in the pyproject.toml. It will however not remove them from pyproject.toml. This behavior exists for packages without any interdependence whatsoever.

Output of running poetry remove tqdm -vvv on the provided pyproject.toml:

Loading configuration file ~/.config/pypoetry/config.toml
Using virtualenv: ~/.cache/pypoetry/virtualenvs/poetry-test-y2U66Zct-py3.10
Updating dependencies
Resolving dependencies...
   1: fact: poetry-test is 0.1.0
   1: derived: poetry-test
   1: selecting poetry-test (0.1.0)
   1: Version solving took 0.003 seconds.
   1: Tried 1 solutions.

Writing lock file

Finding the necessary packages for the current system

Package operations: 0 installs, 0 updates, 2 removals

  • Removing dnspython (2.1.0): Pending...
  • Removing dnspython (2.1.0): Removing...
  • Removing dnspython (2.1.0)
  • Removing tqdm (4.62.3): Pending...
  • Removing tqdm (4.62.3): Removing...
  • Removing tqdm (4.62.3)

A subsequent poetry update will re-install all previously unnecessarily removed packages.

@provinzkraut provinzkraut added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 13, 2021
@provinzkraut provinzkraut changed the title Poetry uninstalls all dependency when removing any dependency via poetry remove Poetry uninstalls all dependencies when removing any dependency via poetry remove Oct 13, 2021
@timw
Copy link

timw commented Oct 13, 2021

I think I'm observing this in 1.2.0a2 when removing a plugin as well:

e.g.

$ poetry plugin add poetry-grpc-plugin
... normal install log ...
$ poetry plugin remove poetry-grpc-plugin
... removes everything including poetry-core ...
$ poetry
Traceback (most recent call last):
  File "/usr/local/bin/poetry", line 5, in <module>
    from poetry.console.application import main
  File "/usr/local/lib/python3.9/site-packages/poetry/console/application.py", line 12, in <module>
    from cleo.application import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

To be clear, this results in poetry effectively uninstalling itself, as it removes all required modules from the global venv.

@finswimmer finswimmer self-assigned this Oct 17, 2021
@swirle13
Copy link

I'm also observing this in 1.2.0a2

I've generally interrupted the uninstall process before it completed, so I'm unsure if mine would also uninstall all the way down through poetry-core but I can confirm I'm also seeing all dependencies removed and pyproject.toml not removing any dependencies.

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
dimbleby pushed a commit to dimbleby/poetry that referenced this issue Apr 21, 2022
Fix an issue where all default dependencies were removed instead of just the selected one (fixes python-poetry#4632)
@nikokaoja
Copy link

This is still an issue in Poetry (version 1.2.0a2) , when removing a specific package all packages are removed.

@thomasjo
Copy link

thomasjo commented Jun 1, 2022

This is still an issue in Poetry (version 1.2.0a2) , when removing a specific package all packages are removed.

@nikokaoja You need to install Poetry 1.2.0b1. Only the latest (beta) release has the required poetry-core dependency that contains the bug fix.

For reference: poetry-core 1.1.0a7 (and newer) contains the relevant fix.

Copy link

github-actions bot commented Mar 2, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants