Skip to content
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

AssertionError: Egg-link […] does not match installed location when symlinks added to venv path #3784

Closed
gsnedders opened this issue Jun 8, 2016 · 7 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@gsnedders
Copy link
Contributor

  • Pip version: 8.1.2
  • Python version: 2.7.11
  • Operating System: ArchLinux

Description:

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.

What I've run:

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)
@xavfernandez
Copy link
Member

Certainly a duplicate of #640

@mimoralea
Copy link

Same issue here -- well but installing without virtualenv. Can't uninstall, can't reinstall. Did you find a way around this issue?

@jameshiew
Copy link

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.

@xavfernandez
Copy link
Member

Closing as duplicate of #640

@MartinThoma
Copy link

@ssbarnea
Copy link
Contributor

ssbarnea commented Apr 1, 2018

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:

  • install foo package using -e in your python installation
  • run tox with --sites-site-packages on the same foo package.
  • now you get the error because 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'

Update : found ugly workaround

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

@lock
Copy link

lock bot commented Jun 2, 2019

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.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

6 participants