[Distutils] Module Installation Issues
Nick Coghlan
ncoghlan at gmail.com
Wed Sep 14 07:38:56 EDT 2016
On 14 September 2016 at 18:02, Paul Moore <p.f.moore at gmail.com> wrote:
> On 13 September 2016 at 23:55, Donald Stufft <donald at stufft.io> wrote:
>> The 90% case works when it’s *only* pure python and there’s no upgrading/downgrading involved, however you can’t control whether there are going to be upgrades/downgrades or not when dependencies are in play because of ==, >=, >, <, <=, etc.
>
> I would be OK with an invocation that only ever installed and never
> did an upgrade, as that would avoid the worst situations. Of course,
> (a) AFAIK pip doesn't have such a method (other than --no-deps) at the
> moment (dependencies are always upgraded if needed) and (b) there is
> an ongoing proposal to change "pip install" to always upgrade, and
> this is the exactly the opposite of what we'd need from the Python
> prompt.
>
> I understood Steve's proposal to be that we detect cases which do an
> upgrade rather than a pure install, and in that case report "you
> should restart your Python session". That's a common[1] pattern on
> Windows, so should be familiar to Windows users, who I suspect are
> more likely to hit this issue.
>
> Paul
>
> [1] Common, but not particularly loved - it's the source of the jokes
> about "your mouse has moved, do you want to restart Windows for this
> change to take effect?"
Agreed, but if we're able to limit the warning to cases where:
1. The requested package wasn't already present; and
2. Installing it upgraded one or more existing packages
that should eliminate a lot of the warning noise.
We could even enhance the filtering a little further by having pip
look at the top level module names in the built wheel(s) and only emit
the warning if at least one of those is already present in
sys.modules. That way, doing:
>>> pip.install("i_need_this")
>>> import i_need_this
in a clean REPL wouldn't emit a warning even if something was upgraded
as part of the install step.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Distutils-SIG
mailing list