question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jameshiewcommented, Oct 2, 2016

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.

2reactions
ssbarneacommented, 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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Egg-link .. does not match installed location of ReviewBoard ...
I believe this was caused by me installing a package at an additional location using the same virtualenv. How can I fix this...
Read more >
I'm in Python purgatory - Linux Mint Forums
The AssertionError: Egg-link /dev/shm/protonvpn-cli-ng does not match installed location of protonvpn-cli (at ...
Read more >
Changelog - pip documentation v22.3.1
Suppress location mismatch warnings when pip is invoked from a Python source tree, so ensurepip does not emit warnings on CPython make install...
Read more >
venv does not create lib64 directory and appropriate symlinks
Creating a new venv on a multilib system does not install an appropriate link from lib to lib64 or the other way around....
Read more >
pip Changelog - pyup.io
Add ``pip inspect`` command to obtain the list of installed distributions ... Suppress location mismatch warnings when pip is invoked from a Python...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found