-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Different results between pip list
and python -m pip list
#7731
Comments
From Python's official documentation for
But won't this behaviour need to be changed for every command pip invokes? If we could somehow skip the package if it is present in the cwd at the start of getting packages. Then, the packages provided to each of these commands would be just those which are not present in cwd. I am not too familiar with |
On reading through the code, I found that all the commands that requires a list of installed distributions, calls the What I thought was to add a check like
after the line https://github.com/pypa/pip/blob/master/src/pip/_vendor/pkg_resources/__init__.py#L564, ie when This works locally i.e. it does not consider the current directory. But I am unable to write a test for it as of now. |
The resolution for this would likely look very similar to my suggestion for fixing a similar issue in |
Hi @pradyunsg, Can I take up this PR and try out the fix you mentioned in the comment above? |
Noting this also applies to |
Environment
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:
Output
The text was updated successfully, but these errors were encountered: