- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.2k
 
Description
Currently, people are regularly running into problems over confusion about which particular Python a particular invocation of pip is going to manage. There are many cases where what Python a particular invocation of pip* is going to invoke is unclear:
pip3 install --upgrade pipwill overwritepipand possibly switch it from pointing to 2.7 to 3.5.pip3isn't specific enough, you might have 3.4 and 3.5 installed.pip3.4isn't specific enough, you might have 3.4.0 and 3.4.1 installed.pip3.4.0isn't specific enough, you might have multiple copies of 3.4.0 installed in various locations.- We don't have a good answer for what the pip binary should be called on alternative Python interpreters like PyPy (
pip-pypy? What if we have two versions of PyPy?pip-pypy2.6? What if we have PyPy and PyPy3?pip-pypy-2.6andpip-pypy3-2.6?). 
Overall, it's become increasingly clear to me that this is super confusing to people. Python has a built in mechanism for executing a module via python -m. I think we should switch to using this as our preferred method of invocation. This should completely eliminate the confusion that is caused when python and pip don't point to the same version of Python, as well as solve the problem of what do you call the binary on alternative implementations.
In addition to the confusion, we also have the fact that pip install --upgrade pip doesn't actually work on Windows because of problems with the .exe file being open. However python -m pip install --upgrade pip does work there.
I see only three real downsides:
- There is a lot of documentation, examples, code or other instances of inertia using just 
pipand this will be churn for those. - It's 10 more letters to type.
 - It doesn't work on Python 2.6.
 
For the first of these, I think the answer is to just have a very long deprecation cycle, in the order of years. I wouldn't even put a specific date on it's removal, I'd just add the warnings and re-evaluate in the future. Luckily we've shipped support for python -m pip for quite some time, so it won't be something that people need to deal with version differences (mostly).
The second of these I don't really have a great answer for, I think that 10 extra letters probably isn't that big of a cost to pay for the reduced confusion and the default answer working on Windows. We could possibly offer a recipe in the docs to restore pip, pipX, and pipX.Y via shell aliases.
This last item is the biggest sticking point for me. As far as I know, Python 2.6 still has far too many users for us to drop it since, as of 6 months ago, it was still ~10% of the traffic on PyPI (source). The problem with Python 2.6 is that it only supports -m when the target is a module not a package. I see four possible solutions to this:
- Don't deprecate 
pip*on Python 2.6. - Add a module like 
pipcli.pythat people can invoke likepython -m pipcliinstead ofpython -m pip. - Move 
pip/to_pip/and makepip.py. - Document that due to limitations of Python 2.6, it will need to be invoked as 
python -m pip.__main__. 
I don't really like the pipcli idea, the other three all have pros and cons, but I think I personally live with  either not deprecating pip* on Python 2.6 and/or documenting that it needs to be invoked as ``python -m pip.main on Python 2.6).
What do the @pypa/pip-developers think?