Cannot remove entries from nonexistent file
See original GitHub issue- pip version: 20.0.2
- Python version: 3.7.6
- Operating system: OSX
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
- In a new folder, create a
setup.py
file:
from setuptools import setup
setup(
name='repro',
version='0.1dev',
)
- Create a virtualenv:
python3 -m venv env
- Install in editable mode:
env/bin/pip install -e .
- Manually remove the file:
rm env/lib/python3.7/site-packages/easy-install.pth
- Attempt to uninstall the editable package:
env/bin/pip uninstall repro
- Observe error message:
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 the easy-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 the easy-install.pth
file. I’m still trying to track down how this happens. Regardless of this, I believe that pip
should not fail to uninstall when the file easy-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! 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
Thanks @uranusjr for the response. I will create a PR to do the same.
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.)