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.

`dist_is_editable` incorrectly reports True when a non-editable dist shadows the editable

See original GitHub issue

Environment

  • pip version: 20.0.2 (probably goes way-back)
  • Python version: Any
  • OS: Any

Description

I noticed this when working on #7670.

After a currently-installed editable package is force reinstalled as non-editable, the dist_is_editable would still report True due to the lingering .egg-link file, creating an inconsistency, since the editable version of the package is shadowed in both sys.path and pkg_resources.

Expected behavior

pip should correctly report the package as non-editable.

How to Reproduce

$ python -m pip list
Package    Version
---------- -------
pip        20.0.2 
setuptools 45.2.0 
wheel      0.34.2 

$ python -m pip install -e git+https://github.com/benjaminp/six.git#egg=six
Obtaining six from git+https://github.com/benjaminp/six.git#egg=six
  Updating ./pip-play/src/six clone
  Running command git fetch -q --tags
  Running command git reset --hard -q 3a3db7510b33eb22c63ad94bc735a9032949249f
Installing collected packages: six
  Running setup.py develop for six
Successfully installed six

$ python -m pip list
Package    Version Location                     
---------- ------- -----------------------------
pip        20.0.2  
setuptools 45.2.0  
six        1.14.0  /private/tmp/pip-play/src/six
wheel      0.34.2  

$ python -m pip install -I six
Collecting six
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: six
Successfully installed six-1.14.0

$ python -m pip list
Package    Version Location                                         
---------- ------- -------------------------------------------------
pip        20.0.2  
setuptools 45.2.0  
six        1.14.0  /private/tmp/pip-play/lib/python3.7/site-packages
wheel      0.34.2

$ python -c 'import six; print(six.__file__)'
/private/tmp/pip-play/lib/python3.7/site-packages/six.py

Notice how the last list results included the Location column (suggesting six is editable), but the reported location (generated by pkg_resources) points to the non-editable one. The interpreter also finds the non-editable one over the editable installation.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sbidoulcommented, Feb 25, 2020

I’m not sure what a fix would look like for this. At first glance I’d consider it normal to risk confusing results when installing with ‘-I’.

0reactions
sbidoulcommented, Aug 1, 2021

Yes. The problem is that neither pkg_resources nor importlib.metadata know about these .egg-link files so we have to have some heuristic to find it. And I don’t know how we could be sure to do it in the same order as the machinery that list installed distributions.

So for now I will not attempt to fix this nor #10243 it in #10249. After all noboy really complains and these minor problems should fade away when PEP 660 is adopted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Making the Default Date Non-Editable
Solved: Hello Everyone, I made a date card as today's date as default. However, I want to make this card non-editable for the...
Read more >
isEditable | Apple Developer Documentation
A Boolean value that controls whether the user can edit the value in the text field.
Read more >
When would the -e, --editable option be useful with pip install?
As the man page says it: -e,--editable <path/url> Install a project in editable mode (i.e. setuptools "develop mode") from a local project ...
Read more >
Tumult Hype Documentation
Convert your shapes into editable vector shapes by first selecting them, ... Drop Shadows provide the most natural shadows for elements, as they...
Read more >
Adobe® InCopy® CC Help
Although a checked-in file is available for editing, it is not actually editable until it is checked out (unless you edit the.
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