Re: [Python-Dev] cpython (3.4): Issue #22295: Adopt 'python -m pip' as the preferred invocation
On Sat, 6 Sep 2014 12:40:19 +0200 (CEST) nick.coghlan <python-checkins@python.org> wrote:
The following command will install the latest version of a module and its dependencies from the Python Package Index::
- pip install SomePackage + python -m pip install SomePackage + +.. note:: + + For POSIX users (including Mac OS X and Linux users), the examples in + this guide assume the use of a :term:`virtual environment`.
Why not advocate --user instead? It is simpler than messing around with virtual environments and will suffice for most use cases. Regards Antoine.
On Sat, Sep 6, 2014 at 7:27 AM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Why not advocate --user instead? It is simpler than messing around with virtual environments and will suffice for most use cases.
I agree, however, --user needs to be more fully integrated into pip's behavior. For example, if I execute pip install --user SomePackage today, when SomePackage is installed someplace outside ~/.local, pip complains that SomePackage is already installed. If I then execute pip install --user --upgrade SomePackage it tries to remove the outdated more global version of SomePackage. Skip
If I then execute
pip install --user --upgrade SomePackage
it tries to remove the outdated more global version of SomePackage.
BTW, I believe this is a known issue: https://github.com/pypa/pip/issues/1851 https://github.com/pypa/pip/issues/1122 Based on the comment in the second issue, it doesn't appear this will be resolved until 1.7 at the earliest. Skip
On 6 September 2014 13:47, Skip Montanaro <skip@pobox.com> wrote:
Based on the comment in the second issue, it doesn't appear this will be resolved until 1.7 at the earliest.
The second issue is specific to setuptools, where we have some very unpleasant hacks to deal with the setuptools/distribute mess. Having said that I don't have an immediate feel for what proportion of the issues around --user are fixed in 1.6, as I don't personally use --user much. Paul
On 6 Sep 2014 23:15, "Paul Moore" <p.f.moore@gmail.com> wrote:
On 6 September 2014 13:47, Skip Montanaro <skip@pobox.com> wrote:
Based on the comment in the second issue, it doesn't appear this will be resolved until 1.7 at the earliest.
The second issue is specific to setuptools, where we have some very unpleasant hacks to deal with the setuptools/distribute mess.
Having said that I don't have an immediate feel for what proportion of the issues around --user are fixed in 1.6, as I don't personally use --user much.
Using virtual environments also avoids some bad interactions between pkg_resources.requires() and the way Fedora (et al) handle parallel installation of mutually incompatible versions of components that use the same module namespace (e.g. CherryPy 2 vs CherryPy 3) into the system Python. The specific reason for the assumption of virtual environment usage on POSIX is slightly different though: inside a virtual environment created with pyvenv, "python" always refers to Python 3, regardless of platform. Thus, the assumption let me avoid a long-winded explanation of PEP 394 and why the system-wide "python" refers to Python 2 and you need to run "python3 -m pip" to install into Python 3 instead. It was the system level pip vs pip3 distinction that prompted the original change to recommending "-m pip", and I realised explaining the vagaries of python vs python3 would be just as distracting & uninteresting for most users. There's a question at the end of the document about installing into the system Python that could probably be expanded on with more details, but there really are enough ugly edge cases to running custom code in the system Python (at least currently) that the simplest answer is "don't". Cheers, Nick.
participants (4)
-
Antoine Pitrou -
Nick Coghlan -
Paul Moore -
Skip Montanaro