-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Why does Pip documentation refer Windows to use an executable named "py"? #10433
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
Comments
It's the recommended way of running Python on Windows, not just by pip, but in general, precisely because the The pip documentation is written for users of "standard" Python, so what Anaconda does is not really relevant (apart from anything else, if you're using Anaconda you should be using Basically the answer is "it's all a complicated mess, and nothing works properly across all possible distributions/environments". The most likely thing to work by far on Windows has always been If someone wants to improve the documentation to explain all of this complexity, then I'd be fine with someone having a go. But you should look at the history fist - this has all been thrashed out many times in the past. Circumstances do change, so that's not saying we won't change the docs, but in my personal opinion, things haven't changed enough yet to make that worthwhile. |
Thanks for the docs. I uninstalled all versions of Python on my computer and ran the Python Foundation installer and it does indeed default to "Install Launcher for all Users (recommended)". I guess crappy Windows installers have taught me to untick all options that say they are going to install something that isn't the exact thing I am wanting to install.
Unfortunately
Conda is multi-functional, it's not just a pip replacement. A perfectly valid use case is to manage the binary dependencies in your enivonrment with conda such as Python, NodeJS, OpenSSL, Rust Compiler, etc. and then use pip to manage your python packages. For a number of reasons this is one of the way I advise teams develop Python applications inside the company I work at.
I wonder if we can ask @zooba on this?
Fair enough, I guess to start off with it might be nice to have the above link in pips docs. First I will try and get pip's development environment working on my machine and build up some experience with py and any other tools. |
The Windows Store Python is different because it can't manage the py.exe installed by the traditional installer. So it was going to make things even messier if it tried to install it into a different location that may/may not be overruled by a traditional install, and all it would have the ability to do is to launch the Python that it was installed with. The best way to launch pip if you've installed from the store is In most cases it's expected to be an alternative to the traditional install. If you get it from the Store, you wouldn't install it from python.org as well (and I certainly haven't installed from python.org since 3.8, because I've got the Store install around). So given that it wasn't going to be reliably consistent with the past Windows experience, that the past Windows experience was woefully inconsistent with everyone's POSIX-by-default instructions, and we didn't have PATH concerns, we went with a more POSIX-like design. (I'm sure I've had this conversation before on this tracker, but guess it didn't turn into doc updates...) |
If you've any suggestions for how the docs can cover this without being even more confusing than they already are, PRs would be appreciated 😉 Personally, I find the inconsistencies that Store python introduced sufficiently annoying¹ (in terms of "it was hard enough to explain before, this just made it worse") that I'm unlikely to tackle such a change myself. ¹ I understand that Store apps have constraints that mean they can't work like the python.org installers, and I have no doubt that the Store install is the most sensible design it can be given those constraints. And maybe even better overall, if we ignore compatibility as a constraint. But it still annoys me that Store python has to be an exception to the "classic" behaviour on Windows. |
This information is very useful thanks, I will try to propagate it further when I update the Python guides for my company or answer Python questions in Reddit.
I can't speak for others but I know I don't have a suggestion right now, I will continue to think on it. But if you want to close this issue feel free to, can always open another or a PR if I feel convinced of a better solution. |
Well, given that I've been fiddling with the docs a whole lot lately, I'd be happy to pick up the documentation updates and make the PR necessary for it here; if someone could state more clearly what the changes need to be. It sounds like we have a more Unix-y experience with the Windows store Python? |
My main concern is that I suspect that many of the people who get confused over this sort of question may be equally confused if you ask them "are you using Python from the Windows Store or from the official installers?" (To say nothing of Anaconda, Chocolatey, cygwin, mingw64, or the various other places they could have got Python from). So before we branch off into whether to use |
All of this is making me think that we should add a paragraph/section/page, talking about "how to run pip" somewhere; to discuss these nuances -- and use exactly one format in the rest of pip's documentation. |
This is not really a pip issue, but I'm wondering if Windows Store apps allow for requesting dependencies. If it's somewhat possible, I'd rather much prefer CPython to officially distribute |
To be honest, I think that it would be better if we could simply link to a central document that says "how to run Python" and then say for pip you run The lack of clear, beginner-friendly instructions on how to run Python (in a way that allows you to add command line arguments like |
Yea, I'm saying we should write up such a document, put it in our documentation and update all our invocations to be just plain This conversation is making me wonder if quirks around |
While I'm spiralling, the thought I have right now is adding a check + warning to the This will need quirks, like path-bassd invocation in a virtualenv and stuff; but this seems surprisingly tractable. BUT combined with PEP 668 preventing users from breaking their system, I think we'd have everything needed to using plain |
As far as I know, there are only two main differences:
The first issue can't really be fixed. The best options we have (all of which have been discussed and discarded in the past) are:
The second difference (user confusion) is not something we can really do much about. People can do My personal thoughts are:
I don't know why @zooba suggests above that |
How about a separate pip-cli package, that provides the executable instead? That package would likely never need to be updated, at least not as often as pip itself. At least, that was the idea in #3164 (comment).
Honestly, I want to standardise on We should definitely keep
I disagree. My proposal for this is literally my previous comment and what I said in the last paragraph, so... not gonna repeat that again. :)
I like how this sounds. :) |
Oh yes! I'd forgotten that idea. That would be a really good solution IMO.
It's certainly more natural for people. And if the Transition will be a bit of a PITA, though. I predict many cases of people having old wrappers lying around that result in very confusing issues. And getting distros to replace their existing wrappers will be a challenge, I suspect (although maybe we don't need to do that, as Unix doesn't have the self-upgrade issue). We'll also need to get it into ensurepip. And I still think the user confusion issue is relevant:
Ah, I think I follow your reasoning now, you're saying that if the pip command validates that it's using the same interpreter as Ultimately, the problem here isn't at the pip level at all, it's that there is no canonical way of invoking the Python interpreter. I don't honestly know how we ended up in such a mess over this - the canonical way to invoke git is via the I guess it's fairly clear to me that if we can get the So in summary, I'm +1 on a pip-cli package, to address the self-update issue, although publicity and management for the change won't be easy. However, I still prefer making |
The FWIW, it is possible through some obscure API calls to make For the "am I using the global
I do. It's because we support side-by-side versions, rather than one incremental version that just updates and is basically backwards compatible, along with separate LTS releases that don't overlap like we have today (which you may recognise as being my release schedule PEP that was rejected in favour of the current one). From the Windows POV, I also looked into renaming |
Edit: See correction below |
Read the rest of that issue, you've summarised it incorrectly. Launching |
Thanks for the info, I did some testing and I see I am mistaken. I don't understand what adjacent means in this context but I will do some more reading. Edit: I see my confusion now, when I was testing the only version of Python on the PATH was the virtual environment (I have even disabled the Windows Store stubs), so I mistakenly assumed that subprocess could only be finding that version of Python. Reading through the issue now I see there is an undocumented(?) secret/hidden/pseudo env variable " |
It's documented, but not an env variable. It's just part of how CreateProcess (and LoadLibrary, for that matter) resolves relative paths. The process image filename is almost certainly going to be read from internal data structures that are easily accessible to the API implementations, so the only way to skip it is to calculate the absolute path. |
Description
I'm trying to follow user guides on getting pip development done and one of the things I notice is that it refers to executing python through an executable called
py
.I run Python almost exclusively on Windows and I don't know what
py
is, I can't google it because "py" or "python py" or "py executable" are all too generic for Google so I can't find any documentation on it, instead Google thinks I'm talking about the ".py" extension.I think it's something that ships optionally with the Python installer from the Python Foundation? But if so it's optional as I've never had it installed. But even so I don't think it ships with the Python from the Windows store, or the Python in Anaconda, Miniconda, Miniforge, Mambaforge, etc...
So why is pip referring to
py
which is this optional thing that's impossible to find documentation on rather than justpython
which is what works on both Windows and other platforms?Expected behavior
python
pip version
all
Python version
all
OS
Windows
How to Reproduce
Read Documentation
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: