Skip to content

Create an App Execution Alias for pip to py -m pip #140

Open
@kenblu24

Description

@kenblu24

Is your feature request related to a problem? Please describe.
Users will want to run pip instead of typing python -m pip.

Describe the solution you'd like
If a user has run python on a Windows computer before, then they should be able to run pip as well.

Describe alternatives you've considered
See #121 "Include pip in PATH"


Additional context

Is there any reason why pip.exe can't get the same treatment that py.exe does? If py.exe gets installed to WindowsApps and is available through App Execution Aliases, then why can't we have a pip.exe reside there as well, which could just be an alias to py -m pip?

From the PEP:

The Windows Store package is very reliable, with the exception of the global shortcuts. Rather than modifying PATH to add its own directory, these shortcuts are created in a single OS managed directory that has all the shortcuts defined by any app. Users are able to modify their PATH to exclude or de-prioritise this directory, leading to unreliable or inconsistent behaviour, and historically we have also seen this caused by installers. For example, installing Python from the Store followed by Python from the traditional installer with its PATH modification enabled will almost always shadow the Store package’s Python with the later install.

It'll adhere to your ethos of not modifying PATH, same as the way you solve the python problem, and thus would work anywhere py.exe would. It would also be overridden by user modifications to PATH. Excuse me as I'm not familiar with any roadblocks for PyManager providing a pip execution alias, but if it's possible, it seems like it would come with the same or fewer challenges as the python execution alias.

Rationale

I assume there's a cost to implement this, both in dev time, support, etc. So I provide my unsolicited thoughts as to why I think it's worth it:

User expectation compared to current Python install methods

Providing this alias alongside py and python would align with the expectation that the automatically installed version provides pip at the command line.

The PEP notes that the current Windows Store installs provide pip, as do MSI installs which have both of the

  • pip
  • Add Python to path

boxes checked.

Specifically, the PEP says:

no global pip command is included (the traditional installer also does not include a global pip command, unless the options to modify PATH and to install pip are selected; the first of these is off by default).

Even though Add Python to path is unchecked by default, users that don't check that box also don't get a usable python command out of it, so what's the point? The previous deal was that if you want python in your path, you also get pip by default, unless you _un_check that pip box.

For users that want python but not pip, I don't think asking them to add a command line option, set an environment variable, or set a config file option is too big of a deal.

Most of the PEP makes sense to me, but treating user expectation of pip availability differently than python itself is a little confusing to me.

pip usage in non-official tutorials and scripts

Personally, I rarely see python -m pip ... recommended anywhere online. The only exception in I have seen in recent memory is when pip tells me to upgrade it.

Furthermore, I have never seen py -m pip ... recommended anywhere except this thread. But then again I've never seen py used in any tutorial or SE post. I didn't even know Ubuntu had a pythonpy package for the alias until just now when I tried to run py on it.

For the sake of consistency with online pip install x instructions, it'd be nice to assume users have the ability to run bare pip on Windows so long as they have python. I'd hate to imagine a future where I have to tell Windows users in particular to run py -m pip while everyone else can just type pip.

Downsides

Other tools

It's worth noting that this doesn't solve the problem of tools not being on PATH.

Many Python tools make commands available. See: https://packaging.python.org/en/latest/guides/installing-stand-alone-command-line-tools/ which mentions tools like flake and pipenv.

Far be it from me to suggest that all the existing tools which do so should have an app execution alias. So I concede that teaching python -m pip would be conducive to users remembering to run python -m virtualenv for example. But also, I find the idea of having to type python -m pip uv install on a regular basis in a few years quite gross.

A lot of these tools, such as pipx and uv, will likely do whatever it takes to ensure that they, along with the packages they install, are available to the user without requiring python -m. But right now, Windows users who can run python can also run pip install virtualenv; virtualenv . rather than python -m pip install virtualenv; python -m virtualenv. It'd be sad if the latter is the most platform-agnostic command. Surely there's a better way, lest I just tell students to get uv as soon as possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions