13 ms·
Windows 10 has “python” command that redirects to the Windows Store
- netsharc 6y agoDidn't OS X do this with some CLIs, you'd type a command and got prompted to download Xcode..
- lann 6y agoSounds familiar, but Xcode does actually provide a bunch of CLI tools...
- _fullpint 6y agoI think it’s when you have to download the Xcode CLI tools that many packages rely on. But you do it once and you never do it again. Definitely not equivalent situations.
- Marsymars 6y ago> But you do it once and you never do it again. Well other than every time there's an Xcode update.
- anaisbetts 6y agoThe only difference is that it's more finely grained? I don't see how it's completely different
- Igelau 6y agoYeah, Java and git in my experience. There's a dumb chain of symlinks to where they really reside.
- saagarjha 6y agoActually a symlink to xcselect, which looks up the command based on the current developer directory.
- nojito 6y agothe Windows Store is the official way to install Python on windows. https://docs.python.org/3.7/using/windows.html#windows-store https://docs.python.org/3.7/using/windows.html#windows-store Original Blog post from last year https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/ https://devblogs.microsoft.com/python/python-in-the-windows-...
- nathanaldensr 6y agoReally? That seems to be the "official" Microsoft way of installing Python3. For those who'd rather go straight to the source (should be everyone), try this, instead: https://www.python.org/ftp/python/3.8.2/python-3.8.2.exe https://www.python.org/ftp/python/3.8.2/python-3.8.2.exe
- nojito 6y agoNo? https://docs.python.org/3.7/using/windows.html#windows-store https://docs.python.org/3.7/using/windows.html#windows-store >The Microsoft Store package is a simple installation of Python that is suitable for running scripts and packages, and using IDLE or other development environments. It requires Windows 10, but can be safely installed without corrupting other programs. It also provides many convenient commands for launching Python and its tools.
- enitihas 6y agoIt is just "one" method of installation, and not even mentioned at the top of the page. The page also says > Note The Microsoft Store package is currently considered unstable while its interactions with other tools and other copies of Python are evaluated. While Python itself is stable, this installation method may change its behavior and capabilities during Python 3.7 releases. It is "an" official method, not the preferred official method, and most certainly not "the" official method.
- qilo 6y agoThat note was for Python 3.7, as of Python 3.8 the note is gone. https://docs.python.org/3.8/using/windows.html#windows-store https://docs.python.org/3.8/using/windows.html#windows-store
- nathanaldensr 6y agoYep, it's real. Nice one, MS. :eyeroll: Directory of C:\Users\user\AppData\Local\Microsoft\WindowsApps 01/15/2020 04:23 PM 0 python.exe 1 File(s) 0 bytes Directory of C:\Users\user\AppData\Local\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe 01/15/2020 04:23 PM 0 python.exe 1 File(s) 0 bytes
- 2OEH8eoCRo0 6y agoSo what? Some Linux distros will suggest installing a missing program if you run it via terminal and it's not installed.
- detaro 6y ago> and it's not installed. is the key difference here, as the submitted tweets clearly point out.
- pbhjpbhj 6y agoI use Ubuntu, one gets (something like) 'you can install with apt-get install missing-program'. I've often wished it offered to do the install; I guess it doesn't because that might break apps trying to call the non-installed program, and messing with history/clipboard is not so good usability wise. I wonder if there's some other built in buffer, or whatever, that could be used to achieve this? So, for example, it could say "press ctrl-alt-v to paste that command now" but still end the program so that a calling program can be sent a "failed to run code"?
- ninjacatex 6y agoThis really irked me when I found out because I spent longer than I care to admit diagnosing why a script I wrote seemingly did nothing. I'm not sure if it's different now but when I had just installed anaconda python, and ran a script the usual way (`python foo.py`) it just did nothing (not even open the store page). My memory might be a little hazy but I think not even changing PATH order of precedence made a difference. I had to find a sub-sub page in the modern settings app to disable the magic store hook. I agree with some others here: I'm fine if I'm suggested a solution to a missing command but when that hook overrides a valid installation I have a bit of a problem :|
- dstaley 6y agoI'm fairly sure that if you install Python using the official installer and select the "Add to PATH" option that the actual executable will be used. I'll check later in a clean VM to confirm and update this comment.
- anaisbetts 6y agoThe problem is that MS's python can end up taking path precedence even if you install via the installer, I've hit this before. It's Just A Bug, one that I'm sure that Microsoft would be very happy to fix if folx complained to the right people. The stub python.exe could very easily search PATH to see if it's getting put first and delegate, or the official Python installer could recognize and fix this
- DoofusOfDeath 6y agoI genuinely don't understand some decisions Microsoft has made with Windows 10. The unavoidable telemetry / updates / ads, this Python thing, etc. are just so different from what I want an OS to do. I can only assume that I'm somehow outside of Microsoft's target market and just don't realize it. But is there really a sizable fraction of computer users that want an OS to unavoidable behave like this?
- Animats 6y agoYes. My last Windows machine just died, and I'm migrating the last few Windows things to Linux. Have to use Wine once in a while. I don't plan to replace the Windows machine. It's so unnecessary today.
- simonebrunozzi 6y agoI've tried to do this multiple times, and yet I have always kept either a Windows machine or (more often) a Mac for a bunch of things. (e.g. Keynote; Outlook in a corporate environment; etc) I loved it in the past, but now I simply don't have time or willingness to spend hours to configure drivers, etc, or do my own system maintenance. My dream is a laptop with a solid linux distro, maintained by a company that doesn't die too easily, with a 3-5 year maintenance guarantee (kind of Ubuntu LTS, as a concept, but for laptop use, not server), where everything works, including a (possibly amazing) trackpad. The other thing is: Mac's trackpads are absolutely the best in the market. That single item is responsible for a big chunk of my productivity boost. When I use a non-Apple trackpad on another laptop, I feel my productivity goes down significantly. I guess twenty years ago it was being able to use vim and bash properly :) - but not today, not anymore, for me at least. Anyway, all of this to ask: what laptop are you using to run Linux? Edit: forgot to add that I've been looking at System76 and Pop OS, but somehow they failed to convince me (together, or separately).
- Animats 6y agoLaptop? I use a desktop machine. Better ergonomics and a much larger screen.
- Lendal 6y agoIt takes a lot of IT knowledge to get a Python script to work properly on Windows. And yet somehow you figured out a way to blast Microsoft for trying in good faith to help out the Python community. And it was done in concert with the Python community, so it's definitely not "fake". This makes me sad.
- detaro 6y agoYou don't think the "yet somehow figured out a way" blame maybe lies with Microsoft for breaking it instead of the user? Nice idea, problematic execution it seems.
- ajross 6y agoMaybe Microsoft was trying to "help out the Python community". But what they did was just awful. Python is, by far, the most popular system glue language in the world. People have spent decades writing it and running it on windows. It has years of culture built up around version detection and deployment strategies, so that developers understand how to get "python" and exactly what they are getting when they do. And now all of a sudden you run a "python" script and you get something that is not a python interpreter. That's just insane. I don't doubt Microsoft's motives, but good grief is this dumb.
- zelly 6y agoAgreed. On the beloved GNU/Linux distros, when you "$ python" and it's not installed, Package Kit will recommend you to install it through the native package manager (like apt or dnf). This is literally the same thing. Windows Store is the package manager for Windows.
- D13Fd 6y agoHard to imagine that this is some nefarious plot when Microsoft also provides one of the most popular Python editors (Visual Studio Code) and an excellent Python extension for it, and makes appearances at Python conferences etc. It seems more like a garden variety screwup.
- scarface74 6y agoAnd Python is supported as a first class citizen in Visual Studio.
- Havoc 6y agoMS is doing a good job of making me move the *nix lately. I can't even _open_ Windows store anymore, let alone check out their python stunt.
- deanCommie 6y agoI'm a developer who's never had to ship serious production systems with Python, but I have had to modify the occasional library or open source package. i.e. I know just enough to get myself into trouble... I develop on a Mac where in theory everything should be easier: * Comes with Python out of the box * Platform has ubiquitous and wonderful package manager (Homewbrew) And yet, 90% of my interactions with Python via the CLI involve it crashing because the version that the current thing I'm trying to compile or execute wants isn't the one the OS happens to be vending for it. Some OSS projects suggest using things like pyenv to help. I don't know, it just seems to make things even worse for me because now even 'which python' doesn't tell me anything because it directs to some shell script shims that I can't parse or understand. Python the language is wonderful, as are the libraries that exist for it. Python the runtime/execution environment is actively hostile to users, and it's honestly keeping me from actually building anything real with it from the ground up. I'm not surprised that Microsoft went with this approach to TRY to help it's users. I'm also not surprised that Python devs are pissed because I've also been in those shoes where FINALLY everything is working, and you think you have that one version of python 2 and one version of python 3 both running and coexisting and everything you need to run runs, and then something small changes and WHAM the whole house of cards collapses. But I wouldn't be angry at Microsoft, I'd be angry at the Python community for letting things get so bad.
- downerending 6y ago> I'm not surprised that Microsoft went with this approach to TRY to help it's users. This approach doesn't help--it makes things worse. I see this occasionally on Linux as well. A novice programmer will think: My program depends on programs X, Y, and Z, and if they're not there, I'll download them from the Internet to make things easier for my user. Aside from being a major security hole, this just makes a mess. The user has no idea of what's going on, and it's 10x harder to debug when something goes wrong. I do relate to your pain. For starters, I'd recommend not using a Mac for Python development (or really any development). If you must, something like a VirtualBox machine running Linux would be good. But probably better to just make a Linux instance in the cloud.
- _bxg1 6y ago> And yet, 90% of my interactions with Python via the CLI involve it crashing because the version that the current thing I'm trying to compile or execute wants isn't the one the OS happens to be vending for it. Do python releases introduce backwards-incompatible changes (ignoring the 2.x/3.x divide)? Would it not be as simple has making sure you have the latest runtime?
- amanzi 6y agoShort of including a full Python installation in the base OS, what Microsoft is doing is a great idea. However, it seems like in some cases your PATH might get in the wrong order which can cause scripts to fail. I haven't encountered this personally and I've used Python on several different Windows 10 machines, each with the full version of Python installed from the website. Bugs happen, and path issues are easily fixed.
- ineedasername 6y agoOnce you install python, is this redirection removed? If so is it only removed if you install from the Microsoft store, or also from a standard install?
- WorldMaker 6y agoThe redirection is done by a low-priority PATH. Both the Store install and the "standard" install (both of which are built/maintained/managed by Python.org, fwiw) should install at a higher priority PATH. PATH bugs are just hard to entirely avoid, but PATH management is relatively easy. (One big for instance is that System PATH and User PATH are concatenated and that the combined PATH when it exceeds a certain character limit sometimes causes subtle bugs like this one. People unfamiliar with Windows-specific PATH issues might not realize that issue.)
- tssva 6y agoThis is not 100% accurate. The "standard" install will place the installation directory higher in the PATH priority. The store version doesn't modify the path. Instead it creates app execution aliases for the executables it installs. As of version 3.8.2 it creates the following app execution aliases: idle.exe, idle3.8.exe, idle3.exe, pip.exe, pip3.8.exe, pip.exe, python.exe, python3.8.exe, python3.exe, pythonw.exe, pythonw3.8.exe, and pythonw3.exe. These can be found in the %LOCALAPPDATA%\Microsoft\WindowsApps directory. Prior to installation the python.exe and python3.exe app execution aliases in this directory will launch the Microsoft Store. After installation of the "store" python they will actually launch python.
- withinrafael 6y agoThis is a half-baked idea by Microsoft, one many of us in the Windows community tried to warn them about last year [1][2] with no apparent success. (One big problem is that build systems/various scripts tend to look for a callable python/python3 to determine if python is installed. Calling out to this stub eats input yet outputs nothing, leading to lots of confusion.) You can turn all Python aliases off by navigating to Settings > Apps > Apps & Features > App execution aliases. Alternatively you can Start search for "aliases". [1] https://twitter.com/WithinRafael/status/1171339229583962112 https://twitter.com/WithinRafael/status/1171339229583962112 [2] https://twitter.com/BruceDawson0xB/status/1170898499870674944 https://twitter.com/BruceDawson0xB/status/117089849987067494...
- pjmlp 6y agoDone in collaboration with the Python community.
- withinrafael 6y agoIs that true? Is there some sort of call for comments from the Python community on this? (Genuine question!)
- pjmlp 6y agoYes, it was even presented at PyCon. https://devblogs.microsoft.com/python/come-meet-microsoft-at-pycon-2019/ https://devblogs.microsoft.com/python/come-meet-microsoft-at... "Steve Dower - Python on Windows is Okay, Actually - PyCon 2019" https://www.youtube.com/watch?v=uoI57uMdDD4 https://www.youtube.com/watch?v=uoI57uMdDD4 And is part of official Python documentation, as mentioned by others on this thread.
- WorldMaker 6y agoIt should also probably be noted that the Microsoft/Windows Store installed version of Python is the official Python.org release. (It's CIed, and CDed directly from Python.org just as with any other release binary.)
- rdtsc 6y agoThis made think of one of my favorite Pycon talks by David Beazley called "Discovering Python": https://www.youtube.com/watch?v=RZ4Sn-Y7AP8 https://www.youtube.com/watch?v=RZ4Sn-Y7AP8 The premise is David got locked in a vault with terabytes of tangled source code on CD-ROMs, no network connection, no ability to bring software in or out, and just a bare Windows machine, and and the story goes from there...
- oefrha 6y agoThere's an actual term for this "fake" command: it's a stub command. Stub commands are by no means a new concept; for instance, on macOS many CLT commands are stubs (that prompt CLT installation), and IIRC the java family of commands in /usr/bin are stubs out of the box, too. The real problem, or the claimed problem, is > Windows 10 puts a fake python/3 executable in the path, ahead of the actual python. (Emphasis mine.) Somehow I'm on the slow ring and I'm not affected by this; the stub is definitely not ahead of the actual python. Why? Because C:\Python38\Scripts and C:\Python38 are way ahead of %LocalAppData%\Microsoft\WindowsApps (where the python.exe stub lives) on my PATH. When you install things naturally they prepend themselves to the path, CPython (or any python) installers included. Begs the question: what kind of geniuses put third-party paths after system paths, then bitch about breakage? Edit: Upon further inspection of some complaints, I think what Microsoft should do is fixing then teaching people proper PATH management on Windows (which is terrible), since apparently all the top google-surfaced tutorials ask you to append to PATH, which opens you up to this kind of self-inflicted problems. (Clicking on "New" when editing PATH creates a new entry at the end; obviously doesn't help.)
- JadeNB 6y agoCLT = Command-Line Tools, for those unfamiliar. (Unfortunately, I can't find an official link that's not behind a developer.apple.com sign-in.)
- oefrha 6y agohttps://developer.apple.com/library/archive/technotes/tn2339/_index.html https://developer.apple.com/library/archive/technotes/tn2339...
- Igelau 6y agoThat was a weird experience when I started using MacOS. "Why are we faking that Java and git are already on here?"
- knolax 6y agoOk but what purpose do stub commands serve? What user is smart enough to be running command line tools but also too stupid to figure out how to install Python? Even if you did want to tell users how to install it you could just do it the Ubuntu way and make it a part of the error the shell throws when it can't find the program. If a program is not installed the expected behavior is that trying to run it leads to some sort error, not a fake program that engages in completely different behavior. If I see /usr/bin/python on my system then I'm going to assume that Python is installed. There's no point in subverting that expectation.
- greggman3 6y agoThis actually points out what I think is a problem. The Windows Store is no longer only sandboxed apps. I wanted to install the Line App (I live in Japan and everyone uses Line and I hate typing on my phone). I have both a Mac and a PC. On Mac I go to the Mac App Store and install Line. I know (believe?) that the app is sandboxed and short of OS bugs can't spy on me. I thought Windows Store was the same but then I saw Python on there and was like "wait a minute, that can't possibly be sandboxed on Windows". So I investigate and ... yea, many apps are not sandboxed. If you look at the Line App (or WhatsApp or Python or FB Messenger) or many others they list > Access all your files, peripheral devices, apps, programs, and registry Which if you dig further Microsoft says > Access all your files, peripheral devices, apps, programs, and registry: The app has the ability to read or write to all your files (including documents, pictures, and music) and registry settings, which allows the app to make changes to your computer and settings. It can use any peripheral devices that are either attached or part of your device (such as cameras, microphones, or printers) without notifying you. It also has access to your location, and can use platform features, such as location history, app diagnostics, and more, which are denied to most Store apps. You can't control most of the permissions for this app in Settings > Privacy.
- deleted 6y ago[deleted]
- pixelmonkey 6y agoThis would be a violation of the advice in PEP 394, except that PEP 394 only applies “to Unix-Like systems”. https://www.python.org/dev/peps/pep-0394/ https://www.python.org/dev/peps/pep-0394/ Basically, the Python core team suggests that the “python” executable/command be set to one of the following: - python2, - python3, - not provide python command, - allow python to be configurable by an end user or a system administrator It would have been much better, IMO, for Windows to do nothing here. A Microsoft-blessed Python installer from the Windows Store could actually serve a positive purpose distinct from the official installer at python.org. That would be to support python2 and python3 side-by-side cleanly. It might nicely install Python 2.7.18 at the python2 executable, and install Python 3.8.2, as well, and have python/python3 refer to 3.8.2 and beyond. This would match an Ubuntu 20.04 system with python2 installed, and with python-is-python3 installed, which is, IMO, how a system should be configured if it needs to have python2 around for backwards compatibility, but wants the “system/default python” to be python3. And it’d make sense for Microsoft to do that since Windows, above all, is a system with a deep respect for backward compatibility with old tools. But, that isn't what they did. Instead, this stub forwarding to the Windows store seems like the worst of all worlds. I am not really sure what problem they are trying to solve and for whom. If you are the kind of Windows user who opens cmd.exe and manually types in “python” into the black terminal window, are you the kind of Windows user who won’t be able to figure out how to open a browser to the official installer on python.org? Doubt it. Meanwhile, the stub likely breaks existing code, even code that may just be running “python -V” to see what version is installed at that path. And apparently the Microsoft-blessed Python installer is just a python3 install (perhaps old), with no thought to python2 and backwards compatibility for old python scripts for Windows? Hmph. This doesn’t seem like an improvement over “do nothing”.
- carlsborg 6y agoPython needed a major technology vendor with political will backing it.
- hutattedonmyarm 6y agoI ranted about this to my group of friends a while ago. I usually explicitely state `python3` when running scripts from the command line in linux and macOS. On my Windows machine I recently installed python for a mini-project and forgot to create a symlink so I could use python3 as a command. I then launched a script (which was working perfectly fine when run via VSCode) from CMD with `python3` and nothing happened. It took me quite a while to figure out, that python3 invoked the stub comman, which did nothing at all when called with a script as parameter. No error, no warning, the store page didn't open. Just empty output
- xg15 6y agoThis is part of a strange pattern of Windows aliasing popular Linux commands to things that do something completely different. There is also "bash", which launches the WSL and "curl", which aliases to a powershell command with completely different arguments.
- jug 6y agoWhy not just include python with Windows? They could take the opportunity to update it with their biannual Windows updates. Otherwise not offer any support for it if they wouldn’t like to.
- nojito 6y agoBecause they would have to support that version of python for the life of the OS...regardless of what happens from the Python community.
- whywhywhywhy 6y agoWhich version of Python would you bundle? The community can't even decide on a runtime. This sort of mess caused Apple to ship Python 2.7 with OSX for 10 years and will stop bundling it at all in future [1] [1] https://developer.apple.com/documentation/macos_release_notes/macos_catalina_10_15_release_notes https://developer.apple.com/documentation/macos_release_note... (search for python on this page)
- agpl 6y agoWell, Microsoft wants to train open source developers to use the Windows store. The whole install gets more and more complex. I've never had a problem when Martin von Loewis was still in charge of the installer.
- WorldMaker 6y agoThe Python team themselves were just as interested in being in the Microsoft Store. Python prides itself on trying to be an easy to install language accessible to a wide variety of users. It should also probably be noted that the Microsoft/Windows Store installed version of Python is the official Python.org release. (It's CIed, and CDed directly from Python.org just as with any other release binary.)