I have a virtualenv, and then move it somewhere with a symlink from the old path to the new path. pip uninstall then fails with Egg-links.
gsnedders@vanveen:~/test$ mkdir foo
gsnedders@vanveen:~/test$ cd foo
gsnedders@vanveen:~/test/foo$ virtualenv -p python2 py2-env
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/gsnedders/test/foo/py2-env/bin/python2
Also creating executable in /home/gsnedders/test/foo/py2-env/bin/python
Installing setuptools, pip, wheel...done.
gsnedders@vanveen:~/test/foo$ source py2-env/bin/activate
(py2-env) gsnedders@vanveen:~/test/foo$ pip install -e html5lib
html5lib should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+
(py2-env) gsnedders@vanveen:~/test/foo$ pip install -e git+https://github.com/html5lib/html5lib-python.git
--editable=git+https://github.com/html5lib/html5lib-python.git is not the right format; it must have #egg=Package
(py2-env) gsnedders@vanveen:~/test/foo$ pip install -e git+https://github.com/html5lib/html5lib-python.git#egg=html5lib
Obtaining html5lib from git+https://github.com/html5lib/html5lib-python.git#egg=html5lib
Cloning https://github.com/html5lib/html5lib-python.git to ./py2-env/src/html5lib
Collecting six (from html5lib)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting webencodings (from html5lib)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=18.5 in ./py2-env/lib/python2.7/site-packages (from html5lib)
Installing collected packages: six, webencodings, html5lib
Running setup.py develop for html5lib
Successfully installed html5lib six-1.10.0 webencodings-0.5
(py2-env) gsnedders@vanveen:~/test/foo$ cd ..
(py2-env) gsnedders@vanveen:~/test$ mv foo bar
(py2-env) gsnedders@vanveen:~/test$ ln -s bar foo
(py2-env) gsnedders@vanveen:~/test$ cd foo
(py2-env) gsnedders@vanveen:~/test/foo$ pip uninstall html5lib
Exception:
Traceback (most recent call last):
File "/home/gsnedders/test/foo/py2-env/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/gsnedders/test/foo/py2-env/lib/python2.7/site-packages/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/home/gsnedders/test/foo/py2-env/lib/python2.7/site-packages/pip/req/req_set.py", line 336, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/home/gsnedders/test/foo/py2-env/lib/python2.7/site-packages/pip/req/req_install.py", line 687, in uninstall
'(at %s)' % (link_pointer, self.name, dist.location)
AssertionError: Egg-link /home/gsnedders/test/foo/py2-env/src/html5lib does not match installed location of html5lib (at /home/gsnedders/test/bar/py2-env/src/html5lib)
Certainly a duplicate of #640
Same issue here -- well but installing without virtualenv. Can't uninstall, can't reinstall. Did you find a way around this issue?
I have this issue as well on Windows 10 with Anaconda. I don't remember my exact steps but I did pip install .
and pip install -e .
in a directory containing a setup.py
for a local project. This wasn't inside a virtualenv. I can now neither uninstall
nor --upgrade install
either and get the same above error.
Closing as duplicate of #640
I don't think that this bug should have being closed as it seems to be easy to reproduce and apparently without a permanent workaround that you can apply to the build/test tools (like tox.ini
).
Here is how I reproduced it:
foo
package was installed from system and pip fails to remove/replace it because of already existing foo.egg-link
file that contains something similar to ../../../../..
.This does not happen if you didn't install the foo
package on the system. Still, pip fails to remove the .egg-link
.
Example:
Installing collected packages: rtox
Found existing installation: rtox 0.0.4.dev7
Exception:
Traceback (most recent call last):
File "/Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180/.tox/py27/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180/.tox/py27/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180/.tox/py27/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180/.tox/py27/lib/python2.7/site-packages/pip/req/req_install.py", line 703, in uninstall
'(at %s)' % (link_pointer, self.name, dist.location)
AssertionError: Egg-link ../../../../.. does not match installed location of rtox (at /Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180)
ERROR: InvocationError: '/Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180/.tox/py27/bin/pip install --upgrade -e /Users/ssbarnea/.rtox/35de9b7012c84f0cbd3609eac8891b4fe532b180'
It seems that I was able to find a way to avoid triggering this bug by adding two lines before the one installing the package in develop mode inside tox.ini:
[tox]
package=foo
[testenv]
commands =
python -c "from distutils.sysconfig import get_python_lib; import os; f = os.path.join(get_python_lib(), '{[tox]package}.egg-link'); os.unlink(f) if os.path.isfile(f) else 0"
pip install -e .
# ... other test commands
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I have this issue as well on Windows 10 with Anaconda. I don't remember my exact steps but I did
pip install .
andpip install -e .
in a directory containing asetup.py
for a local project. This wasn't inside a virtualenv. I can now neitheruninstall
nor--upgrade install
either and get the same above error.