-
Notifications
You must be signed in to change notification settings - Fork 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
Cannot remove entries from nonexistent file #7856
Comments
Sounds reasonable to me. The error message can continue to exist, but the uninstallation command does not need to fail. (It would help if pip has a mechanism to fail with a specific error code, but if the choice is between 1 and 0, I would prefer 0.) |
I can take this issue up and create the PR, but I have a question about the type of changes we want here. If I understand correctly, we add pip/src/pip/_internal/req/req_uninstall.py Line 532 in f6b5b40
So in order to fix the issue, do we want to stop checking for easy-install.pth here? Or do we check for easy-install.pth but not raise an exception if it isn't found at pip/src/pip/_internal/req/req_uninstall.py Lines 588 to 592 in f6b5b40
|
We would still want to remove it if possible (and to emit an error message if it does not exist), so I’d say the latter. I did not read very deep into the implementation though, so there might be another way. |
Hi @uranusjr, Okay, so do we want to emit the error message, but not cause the installation to fail by perhaps wrapping pip/src/pip/_internal/req/req_uninstall.py Line 532 in f6b5b40
in a try catch? Or instead of raising an error at pip/src/pip/_internal/req/req_uninstall.py Lines 588 to 592 in f6b5b40
we can raise a warning using the warnings module, or just log the error and continue |
Hi @uranusjr , If my above suggestions make sense now, I can go ahead and create a PR for the same |
I like the second approach more; it’s probably enought to |
Thanks @uranusjr for the response. I will create a PR to do the same. |
Problem
It appears that when attempting to uninstall a package that was installed in editable mode, removing it does not work correctly if the
lib/python3.7/site-packages/easy-install.pth
file does not exist.Reproduction
setup.py
file:python3 -m venv env
env/bin/pip install -e .
rm env/lib/python3.7/site-packages/easy-install.pth
env/bin/pip uninstall repro
ERROR: Cannot remove entries from nonexistent file /..../env/lib/python3.7/site-packages/easy-install.pth
Expected Behavior
The uninstall should complete successfully, removing the
.egg-link
, even if theeasy-install.pth
file is not found.Notes
In the wild, there is something that happens with our internal setup that causes the
egg-link
, to be created, but not theeasy-install.pth
file. I'm still trying to track down how this happens. Regardless of this, I believe thatpip
should not fail to uninstall when the fileeasy-install.pth
doesn't exist, as the operation it would have done there would have just removed the entry from the file anyway.I am happy to provide any further detail if needed. Thanks! :)
The text was updated successfully, but these errors were encountered: