-
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
pip list
looks at sys.path
for listing installed packages
#11130
Comments
Changing how Personally, I'd rather see a dedicated environment management tool built on top of pip, instead of expanding pip's scope (which is already large) to cover this as well. (Also, there are already environment managers, one of them may already cover this). |
That was a quick update! My thought was to only change the non-porcelain API, and have a flag that becomes opt-out over some period? But, I can see the hesitancy here - any pip behaviour change is likely breaking. I actually use a project manager, but this came up in the context of a user of a compute cluster (which have habits of messing with PYTHONPATH) seeing a different version to the one that they thought they'd installed (which was in fact the case, they'd installed the newer version before the env var was set). My motivation for saying that this isn't an environment feature is that EDIT: I note that this only happens when you try to remote packages whilst inside a virtual environment. However, you have a much better sense of what the best outcome is here, so I'll leave it up to you / the other maintainers to close if you feel it's out of scope :) |
I don't really know what you mean by the "non-porcelain API". Were you meaning the JSON format output? Even so, there's a whole bunch of unanswered questions around what it even means to say whether pip can manage a location (there's I don't think we're likely to do this without a fairly compelling and detailed real-world use case (and no promises even then 🙂). Theoretical arguments about what pip should do, or what makes sense, are likely to just go round in circles forever. |
Ah, apologies - that's a Git term that I'm using to mean non-programmatic e.g.
That's reasonable, let's close this issue then - I can't provide a strong argument that something is breaking - this behaviour is problematic for debugging, but is not breaking anything per se. |
Particularly when I have an environment manager I call Pip using some form of |
Yes, I find it a lot easier to default to |
Description
Currently,
pip list
will return a list of packages it finds onsys.path
vs
$ PYTHONPATH="/some/other/venv/site-packages" pip list Package Version ------------------------- ----------- absl-py 1.0.0 anyio 3.6.1 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 attrs 21.4.0 awkward 1.8.0 Babel 2.10.1 backcall 0.2.0 beautifulsoup4 4.11.1 black 22.3.0 bleach 5.0.0 boost-histogram 1.3.1 certifi 2021.10.8 cffi 1.15.0 ...
Expected behavior
I can see a benefit in giving users a sense of which packages Python is aware of, but I think the existing behaviour is confusing the responsibility of pip. My expectation is that pip should list the packages installed under its control i.e. site-packages.
There may be good reasons for the existing behaviour, but if not, I have a suggestion:
pip list
should first list all packages under paths that it can manage (i.e uninstall).pip list
).pip
should continue to accept additional paths to search, which are included in this sectionThere are some details that might need to be examined, i.e.
pip version
22.0.2
Python version
3.10.4
OS
Ubuntu 22.04
How to Reproduce
pip list
with A's environment, andPYTHONPATH
set to include B'ssite-packages
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: