question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why does Pip documentation refer Windows to use an executable named "py"?

See original GitHub issue

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 just python 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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

3reactions
pfmoorecommented, Sep 4, 2021

py is the Python launcher, and it’s covered in the documentation.

It’s the recommended way of running Python on Windows, not just by pip, but in general, precisely because the python command does not work consistently (it’s not installed on PATH by default in the python.org installers, it doesn’t behave the same as on Unix, where python runs Python2, and you need python3 to run Python 3, etc).

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 conda, not pip, anyway). The Windows Store Python is an oddball, which doesn’t work the “standard” way. I don’t know why they chose to work differently, but frankly it’s just made things more complicated than they already were 🙁

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 py, so that’s what we document.

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.

2reactions
uranusjrcommented, Sep 11, 2021

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 py in the Store that gets installed when any Python version is installed. The py command made calling Python on Windows much easier for newcomers, and it’s very disappointing that CPython is now effectively breaking their own good idea and actively confusing everyone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the difference between 'py' and 'python' in the ...
On Windows. python is the Python executable of the Python installation which you have selected as a default during the installation.
Read more >
Using Python's pip to Manage Your Projects' Dependencies
The pip install <package> command always looks for the latest version of the package and installs it. It also searches for dependencies listed...
Read more >
4. Using Python on Windows — Python 3.11.1 documentation
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. Unlike most Unix...
Read more >
How to Install Pip on Windows - ActiveState
Pip is the standard package manager for Python. It enables the installation and management of third party packages that provide features and ...
Read more >
User Guide - pip documentation v22.3.1
python -m pip executes pip using the Python interpreter you specified as python. So /usr/bin/python3.7 -m pip means you are executing pip for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found