[Distutils] Code for inserting paths into system configuration?

Nick Coghlan ncoghlan at gmail.com
Wed Sep 14 00:13:43 EDT 2016

On 14 September 2016 at 07:00, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
> On Sep 13, 2016, at 12:58 PM, Matthew Brett <matthew.brett at gmail.com> wrote:
>> I was reflecting on the detail of putting pip user bin directories on
>> the user's path, and was then thinking of making a tiny pip package
>> like this:
>> pip install pip_user_config
>> python -m pip_user_config
>> where the latter would cleverly insert the user bin directory into the
>> user's configuration.
>> Does anyone know of any code to do something like that?
> This is shell- and platform-specific.  This would be a great idea!  But it would be a challenging integration project.

I know the Anaconda installer (the Continuum Analytics one) does this
(since I've reported a bug against it for messing up user level access
to the system SQLite installation), but I don't know if the code for
that is publicly available anywhere (conda itself is open source, but
I'm not sure about the build scripts for their installers).

That said, as far as I know, just covering the discrepancy on Debian
and Ubuntu between "the system pip is patched to use --user by
default" and "~/.local/bin is not on PATH by default when using the
default shell" would cover most of the cases where this comes up.

Even short of automating the config change though, there could be
significant value in having a "check_install_config" utility that you
ran as:

    pip install [--user] check_install_config
    python -m check_install_config

and answered some essential fault diagnosis questions like:

- which Python version is being used?
- is there an active virtual environment?
- is it a venv environment or a virtualenv one?
- where will package installations go by default?
- where will they go with --user specified?
- where will script installations go in those two cases?
- are both of the binary install directories on the user's executable path?


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Distutils-SIG mailing list