Skip to content

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

@uranusjr

Description

@uranusjr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: needs triageIssues/PRs that need to be triaged

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions