-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
S: needs triageIssues/PRs that need to be triagedIssues/PRs that need to be triagedtype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
Description
pip uninstall -y <pkg>
does not display warnings for files it does not remove, which means you can think an uninstall was successful while you are left in a bad state due to lingering files.
Expected behavior
pip uninstall -y <pkg>
should display warnings for files that are not removed. This information is already shown for pip uninstall <pkg>
.
e.g.
WARNING: Did not remove `.venv/lib/python3.11/site-packages/idna-3.6.dist-info/FOO
pip version
23.3.2
Python version
3.11.4
OS
macOS
How to Reproduce
Here's a script to reproduce in a clean environment:
python -m venv .venv
source .venv/bin/activate
python -m pip install pip==23.3.2 > /dev/null 2>&1
set -eux
SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
pip install --no-cache idna==3.6 > /dev/null 2>&1
# Create an extra file, this is "silly" but you can end up in this state without touching `site-packages` manually
touch $SITE_PACKAGES/idna-3.6.dist-info/FOO
# Shows "would not remove" warning
yes | pip uninstall idna
pip install --no-cache idna==3.6 > /dev/null 2>&1
# Does not show warning
pip uninstall -y idna
rm -rf .venv
Output
++ python -c 'import site; print(site.getsitepackages()[0])'
+ SITE_PACKAGES=.venv/lib/python3.11/site-packages
+ pip install --no-cache idna==3.6
+ touch .venv/lib/python3.11/site-packages/idna-3.6.dist-info/FOO
+ yes
+ pip uninstall idna
Found existing installation: idna 3.6
Uninstalling idna-3.6:
Would remove:
.venv/lib/python3.11/site-packages/idna-3.6.dist-info/*
.venv/lib/python3.11/site-packages/idna/*
Would not remove (might be manually added):
.venv/lib/python3.11/site-packages/idna-3.6.dist-info/FOO
Proceed (Y/n)? Successfully uninstalled idna-3.6
+ pip install --no-cache idna==3.6
+ pip uninstall -y idna
Found existing installation: idna 3.6
Uninstalling idna-3.6:
Successfully uninstalled idna-3.6
+ rm -rf .venv
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Metadata
Metadata
Assignees
Labels
S: needs triageIssues/PRs that need to be triagedIssues/PRs that need to be triagedtype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior