[Distutils] The future of invoking pip

Donald Stufft donald at stufft.io
Sun Nov 8 20:13:41 EST 2015

On November 5, 2015 at 4:08:56 PM, Donald Stufft (donald at stufft.io) wrote:
> Another possible option is to modify pip so that instead of installing into
> site-packages we instead create an "executable zip file" which is a simple zip
> file that has all of pip inside of it and a top level __main__.py. Python can
> directly execute this as if it were installed. We would no longer have any
> command except for ``pip`` (which is really this executable zip file). This
> script would default to installing into ``python``, and you can direct it to
> install into a different python using a (new) flag of ``-p`` or ``--python``
> where you can specify either a full path or a command that we'll search $PATH
> for.

I’ve implemented a proof of concept of this which can be found at https://github.com/pypa/pip/pull/3234. It’s quick and dirty so probably will break down in edge cases. I also know it currently doesn’t generate a ``pip.exe`` on Windows, so if someone runs it on Windows they’ll need to execute it as ``python path/to/Scripts/pip``.

I’ve not tested trying to install it via wheel or even installing it via pip, so you’ll want to check out the branch or download a tarball and run ``python setup.py install`` (or you can run ``python setup.py build`` and just execute ``build/script-X.Y/pip``).

You might see errors if you don’t build it in a clean virtual environment. That’s just because I haven’t bothered to try and isolate the build by default yet.

Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

More information about the Distutils-SIG mailing list