Skip to content

Different results between pip list and python -m pip list #7731

@uranusjr

Description

@uranusjr

Environment

  • pip version: 19.0 or later (I didn’t test earlier versions)
  • Python version: any
  • OS: any

Description

From pypa/pipx#365. The result list would either include the package in the working directory or not, depending on how pip is invoked.

  • pip list would not contain the package in cwd.
  • python -m pip list would contain the package in cwd.

Expected behavior

The behaviour should be the same no matter how pip is invoked. Ideally the package in cwd should not be included (unless the package is also in sys.path other than .).

How to Reproduce

Create package metadata in cwd:

mkdir foo
cd foo
echo "from setuptools import setup; setup(name='foo', version='1.0.0')" > setup.py
python setup.py egg_info

Output

$ pip list
Package    Version
---------- -------
pip        19.0.3 
setuptools 40.8.0

$ python -m pip list
Package    Version
---------- -------
foo        1.0.0  
pip        19.0.3 
setuptools 40.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: list/show'pip list' or 'pip show'auto-lockedOutdated issues that have been locked by automationstate: awaiting PRFeature discussed, PR is neededtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions