packaging.python.org icon indicating copy to clipboard operation
packaging.python.org copied to clipboard

Address the python3 command issue on Windows

Open uranusjr opened this issue 4 years ago • 6 comments

A lot of the support requests on pypa/packaging-problems are Windows users not being able to run the python3 command, since it is not shipped with the official CPython distribution. (recent example: pypa/packaging-problems#373)

Microsoft recently added a python3.exe stub that automatically opens the Windows Store page if you does not have the Store-provided Python installed. The problem is, the stub would silently do nothing if you pass any arguments to it, making users very confused.

I don’t have a perfect solution, unfortunately. The default python on macOS is still Python 2 (with a warning message), so that won’t work. py -3 is the recommended command for the official CPython distribution on Windows, but IIRC it is not shipped with the Windows Store distribution. The situation is quite bad, if I am being honest.

uranusjr avatar Jun 30 '20 12:06 uranusjr

Agreed this is a bad situation. IMO it should be raised as an issue against CPython, flagging that the current state of the Microsoft stubs means that there is no reliable way of writing documentation that will work cross-platform for beginners or users unfamiliar with the command line.

I don't think we'll get a solution (arguably, the MS stubs aren't even the responsibility of the CPython devs) but it would be good to at least have an issue to track this.

pfmoore avatar Jun 30 '20 12:06 pfmoore

@brettcannon, @zooba, any thoughts here?

di avatar Jun 30 '20 13:06 di

I am far from a Windows expert, so I'm not a good person to ask. 😄 But personally I always add python3 to PATH when I do an install.

And unless we can convince every Linux distro to install the Python Launcher for UNIX once it's finished, I don't think pointing users at py is going to work either.

brettcannon avatar Jun 30 '20 19:06 brettcannon

I should’ve mentioned it in the top post: the official CPython distribution does not contain a python3.exe executable. So python3 would end up calling the Windows stub even if the user adds the installed CPython distribution to PATH.

uranusjr avatar Jul 01 '20 05:07 uranusjr

Apologies for missing this (trying to clear out my GitHub notifications tonight).

We have fixed the lack of message in that executable, so as updates roll out it should help. (This is a 6-12 month exercise... the bug has been fixed for a while already.)

As for people being confused by the lack of a python3.exe, well, that's always been the case. I don't think things have gotten any worse here (though I do think it would get worse if python3.exe started meaning "the most recently installed version of Python 3.x", and it would also get worse if it started injecting an additional process so we could find the latest version and run that instead). Without the stub, people would get an error message, and soon they'll also get an error message, neither of which would really help them.

Best case scenario (assuming no time travel) would be for venv activate scripts to put python3.exe on PATH, and then we lead people into using those. But if we do that, then plain python is also going to work on other platforms, so we may as well lead everyone down that path (which avoids the need for time travel).

zooba avatar Nov 07 '20 00:11 zooba

Best case scenario (assuming no time travel) would be for venv activate scripts to put python3.exe on PATH, and then we lead people into using those.

This would definitely help. Personally I believe the best solution is to make the py command available on all platforms so everyone can just use that instead, since both python or python3 are already problematic in more than one way anyway. I don’t think that’s going to happen very soon, unfortunately. Telling people to always use virtual environments feels like an acceptable stop-gap solution to me.

uranusjr avatar Nov 07 '20 05:11 uranusjr