pip: wonky pth file breaks upgrade
nstalling collected packages: pbr, pip
Found existing installation: pbr 0.10.0
Cleaning up...
Removing temporary dir /tmp/pip_build_root...
Cannot remove entries from nonexistent file /home/robertc/work/openstack/oslo.config/easy-install.pth
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1431, in install
requirement.uninstall(auto_confirm=True)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 555, in uninstall
paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1785, in add_pth
self.pth[pth_file] = UninstallPthEntries(pth_file)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1868, in __init__
raise UninstallationError("Cannot remove entries from nonexistent file %s" % pth_file)
UninstallationError: Cannot remove entries from nonexistent file /home/robertc/work/openstack/oslo.config/easy-install.pth
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 24 (7 by maintainers)
Commits related to this issue
- TEST: Use `--ignore-installed` as workaround of conda `conda` ships with setuptools but lacks a corresponding easy-install.pth. Attempting to upgrade setuptools using `pip` fails because easy-install... — committed to tulip-control/tulip-control by slivingston 8 years ago
- TEST: Use `--ignore-installed` as workaround of conda `conda` ships with setuptools but lacks a corresponding easy-install.pth. Attempting to upgrade setuptools using `pip` fails because easy-install... — committed to tulip-control/tulip-control by slivingston 8 years ago
- TEST: Use `--ignore-installed` as workaround of conda `conda` ships with setuptools but lacks a corresponding easy-install.pth. Attempting to upgrade setuptools using `pip` fails because easy-install... — committed to tulip-control/tulip-control by slivingston 8 years ago
- TEST: Use `--ignore-installed` as workaround of conda `conda` ships with setuptools but lacks a corresponding easy-install.pth. Attempting to upgrade setuptools using `pip` fails because easy-install... — committed to tulip-control/tulip-control by slivingston 8 years ago
- dockerfile: Use `--ignore-installed` as workaround of conda This commit fixes the following error: ``` Collecting setuptools==19.4 Downloading setuptools-19.4-py2.py3-none-any.whl (471kB) Installi... — committed to jcfr/slicer_cli_web_plugin by jcfr 8 years ago
- requirements: unpin version of setuptools and require >= 28.0.0 As suggested by @mivade: "Considering the target audience is likely using anaconda/miniconda, I would think the most sensible thing is ... — committed to scikit-build/scikit-build by jcfr 8 years ago
- Adding --ignore-installed to solve https://github.com/pypa/pip/issues/2751 — committed to openvax/neoantigen-vaccine-pipeline by julia326 6 years ago
- Fix problems building docs during testing * Build docs using python3 * Work around a bug involving pip and setuptools: https://github.com/pypa/pip/issues/2751 — committed to hmpf/nav by hmpf 5 years ago
- Fix problems building docs during testing * Build docs using python3 * Work around a bug involving pip and setuptools: https://github.com/pypa/pip/issues/2751 — committed to hmpf/nav by hmpf 5 years ago
- Fix problems building docs during testing * Build docs using python3 * Work around a bug involving pip and setuptools: https://github.com/pypa/pip/issues/2751 — committed to hmpf/nav by hmpf 5 years ago
I tried filing this as an anaconda bug, but @ilanschnell closed it as a setuptools/pip issue. I’m including a summary of the discussion here:
Setup
The bug
Trying to
install -U
any package depending on setuptools also fails with the same error.Known workarounds
Adding the
--ignore-installed
option will sucessfully upgrade setuptools and the problem will be solved for the lifetime of that particular conda environment. Downloading and running ez_setup.py also fixes the problem for that conda environment. The second workaround will create the missing pth file, while the first will not, but in both cases everything seems to work afterwards.While using
conda
to upgrade setuptools is also a workaround, it is not a good solution, since a lot of packages on pypi (1822 in 2013) depend on setuptools and therefore try to upgrade setuptools too, when upgraded:A lot of pypi packages are not installable using
conda install
, and so using conda to upgrade these is not an option.None of these workarounds are good permanent solutions to this bug because:
-I
fixes the problem and will have to spend a considerable amount of time searching for some solution.Cause
The error message is correct, there is no easy-install.pth file in site-packages. The error occurs when pip tries to uninstall the old setuptools package, in pip/req/req_uninstall.py:160. The file pip is trying to remove (easy-install.pth) does not exist in a fresh Anaconda/Miniconda installation because no conda packages are able to include this file.
This is a periodically sleeping bug, since it rears its head whenever the conda setuptools version (currently 18.8.1) lags behind the pip setuptools version (currently 19.1.1).
The assumption of easy-install.pth file is guarded by a check for .egg:
So my guess is that your conda package looks like an easy_install egg: this may confuse other tools as well. Perhaps don’t do that?
I’m marking this as awaiting response. Please comment if the recently-released 20.1b1 still has this problem. Otherwise the bot will auto-close this after some time.
No, you’ve misunderstood. .egg-info is not the same as .egg. The test I pasted is for “SOMETHING.egg”, not “SOMETHING.egg-info”. What you are doing with .egg-info files is probably correct (though I haven’t read your code to authoritatively say so).
Correct, conda packages usually include
.egg-info
(as it is installed by setuptools during the build process). If we removed all.egg-info
files from conda packages, pip wouldn’t be able to see what’s installed at all (and try to overwrite packages). Not including.egg-info
files wouldn’t be a problem for conda itself. For conda,.egg-info
files are just like any other files that are part of a conda package. Many conda packages (the ones which are not Python specific, such aslibxml2
,hdf5
,r
, etc.) have no.egg-info
files either.