[Catalog-sig] Use user-specific site-packages by default?

Carl Meyer carl at oddbird.net
Tue Feb 5 17:43:25 CET 2013


On 02/05/2013 04:58 AM, Nick Coghlan wrote:
> So, to clarify, the behaviour I would *like* to see pip exhibiting is
> for the default install location to *change*, rather than trying to
> install to the system packages directory and then implicitly falling
> back to the user directory if that fails. Instead, installing to the
> system site-packages would require an explicit "--system" flag.

Well, this does have backwards-compatibility implications, of course,
but that could be handled with a transitional release. Definitely better
than guessing based on writability.

> Desired final behaviour:
> 
> Inside a virtual environment:
>     pip install pkg: works as now
>     pip uninstall pkg: works as now
> 
> Ordinary user (no write-access to system site packages):
> 
>     pip install pkg: installs to per-user site packages
>     pip uninstall pkg: uninstalls from per-user site packages
>     pip install --user pkg: installs to per-user site packages
>     pip uninstall --user pkg: uninstalls from per-user site packages
>     pip install --system pkg: fails (likely with a permissions error)
>     pip uninstall --system pkg: fails, even if the package is present
> (likely with a permissions error)
> 
> Administrator/root (write-access to system site packages):
> 
>     pip install pkg: asks for confirmation before installing to
> per-user site packages
>     pip uninstall pkg: asks for confirmation before uninstalling from
> per-user site packages
>     pip install --user pkg: installs to per-user site packages
>     pip uninstall --user pkg: uninstalls from per-user site packages
>     pip install --system pkg: install to system site packages
>     pip uninstall --system pkg: uninstalls from site packages
> 
>     Confirmation message: "Warning: the current user has write access
> to the system site-packages directory, but '--system' was not
> specified. Proceed with installation to/uninstallation from the user
> package directory at 'path/to/user/dir'? (y/n)"

"pip uninstall" doesn't have any logic about deciding where to uninstall
from (it doesn't even take a --user flag), it just asks pkg_resources
for the location of the package by that name, wherever it might be
found, and then uninstalls it from there (if it can). I'm not convinced
that behavior should be changed, but that doesn't impact the core of
your proposal, which is about "pip install".

Carl


More information about the Catalog-SIG mailing list