Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Message on Linux (and talking to Linux Vendors) #5346

Closed
pradyunsg opened this issue Apr 28, 2018 · 32 comments
Closed

Upgrade Message on Linux (and talking to Linux Vendors) #5346

pradyunsg opened this issue Apr 28, 2018 · 32 comments
Labels
auto-locked Outdated issues that have been locked by automation OS: linux Linux specific project: <downstream> When the cause/effect is related to redistributors type: maintenance Related to Development and Maintenance Processes

Comments

@pradyunsg
Copy link
Member

pradyunsg commented Apr 28, 2018

It seems pip's current upgrade message instructions on Linux doesn't really match what the OS package managers would want users to do -- running pip install --upgrade pip on a Debian/Fedora system can break it (especially when they might end up doing sudo pip or something like that).

It would be nice if we could ask the upstream vendors to modify their version of pip to either not show the message or (better) show the message when the OS vendors the newer version, with appropriate instructions.


For easier future reference; as on 16th July 2018, the following are the people we'd want to ping based on Distro:

Additionally, we have Conda folks too: @kalefranz @jakirkham @msarahan

@pradyunsg pradyunsg added project: <downstream> When the cause/effect is related to redistributors OS: linux Linux specific type: maintenance Related to Development and Maintenance Processes labels Apr 28, 2018
@pradyunsg
Copy link
Member Author

pradyunsg commented Apr 28, 2018

I guess that @ncoghlan would be a good person to ask for inputs here.

Doing some research, @warsaw for Debian and @stratakis for Fedora might be the right people to ping here about this.

@benoit-pierre
Copy link
Member

You could suppress the message when pip is unvendored, as that's a pretty good way to tell pip is installed from a distribution package manager.

@pfmoore
Copy link
Member

pfmoore commented Apr 28, 2018

While it's not a reason for not doing this, the problem is that we can put such a change in the next version of pip, but the problem is precisely for the cases where the OS version of pip is old, so the fix won't help for a long time.

So while I agree with the change, I think explaining to distro vendors the need for them to customise the selfcheck would be beneficial as well.

@ncoghlan
Copy link
Member

At a pip implementation level, I'd suggest checking INSTALLER in pip's own dist-info directory to decide whether or not to run the version check, as that would also add an incentive for distro packagers to ensure that they modify the INSTALLER file appropriately (rather than leaving it as pip, which is what happens when the results of pip-based installation into the build root are copied without modification into the resulting package).

At a documentation level, I also agree with Paul that it would be good to recommend that redistributors patch that message appropriately for their particular system.

@stratakis
Copy link

Thanks for creating the issue and notifying us! We recently got bitten by this in Fedora and I guess it was only reported now due to the incompatibilities between pip 9 and pip 10. I'm pretty sure many more people have actually updated pip using that method. We are tracking the issue now downstream and we'll change the message accordingly.

I am also thinking if it would be possible to entirely disable this behaviour (using pip to upgrade pip) while not inside a venv.

@hroncok
Copy link
Contributor

hroncok commented May 2, 2018

I wasn't aware that this is tracked here, thanks @stratakis for pointing me here. Several things I consider important:

  • The massage explicitly mentions pip install --upgrade pip -> that would attempt to upgrade the Python 2 pip on Fedora*. The message is like this even when pip3 or python3 -m pip was used to run pip.
  • The pip install --upgrade pip command does not work on Fedora* - it will fail with Permission error. Users then immediately try with sudo and that can be nasty.
  • Even python3 -m pip install --user --upgrade pip isn't particularly nice: executing just pip3 after the upgrade still uses /usr/bin/pip3 and that's comes from the old version. (That's probably something we can solve with PATH order.)

However, the message is completely fine in venv. If we are changing it, let's make sure we are not changing it there. I wonder if INSTALLER in pip's own dist-info differs in venv. If it does, @ncoghlan's solution is perfect.

* outside of venv

@hroncok
Copy link
Contributor

hroncok commented May 4, 2018

I'm working on a patch for Fedora. Will test it and provide a PR.

@hroncok
Copy link
Contributor

hroncok commented May 4, 2018

Fedora PR first: https://src.fedoraproject.org/rpms/python-pip/pull-request/5

Note that I went with the easy option: I just disabled the warning when INSTALLER doesn't say pip. Allowing different messages based on different INSTALLERs would also require different checking for the newer version (when a new version of pip is released, it takes a while before it is packaged for distros). I felt like the entire thing would need to be redesigned if we would like to allow that. So my patch only went with the simple option: not installed by pip? no warning.

@ncoghlan
Copy link
Member

ncoghlan commented May 4, 2018

Silencing the warning for non-pip installs in general seems reasonable to me, since redistributors also tend to have their own ways of encouraging upgrades-by-default (e.g. Fedora Workstation points out available updates on start-up, and then has release-monitoring.org+the-new-hotness to nudge package maintainers to make those updates available to their users).

@hroncok
Copy link
Contributor

hroncok commented May 4, 2018

pip PR: #5368

@pradyunsg
Copy link
Member Author

pradyunsg commented May 10, 2018

Oh, while we're here, who all should I ping when there's something related to pip and how it interacts with Linux Distros?

@pradyunsg
Copy link
Member Author

Maybe @doko42 (if not @warsaw) is the right person to ping for Debian? 1

@hroncok
Copy link
Contributor

hroncok commented May 10, 2018

For Fedora that would be @torsava @stratakis and me on GitHub. Don't know if you can ping a group with @fedora-python.

@pradyunsg
Copy link
Member Author

Thanks for the info @hroncok!

I don't think you can send notifications by mentioning a group.

@mbargull
Copy link

Oh, while we're here, who all should I ping when there's something related to pip and how it interacts with Linux Distros?

Even though there is no "Conda Linux", I'd like to bring up some Conda folks like @kalefranz and @jakirkham, if you don't mind (in reference to assessments like in #5060 (comment)).

@pradyunsg
Copy link
Member Author

Sure thing, thanks @mbargull. :)

@doko42
Copy link

doko42 commented May 11, 2018 via email

@pradyunsg
Copy link
Member Author

Updated the title to be more on-topic to how this discussion went. :P

@eli-schwartz
Copy link
Contributor

The Arch Linux maintainer for pip would be @felixonmars, though I would not be averse to being pinged myself as well.

(I don't have access to the [extra] repository where we package pip, but I do do some python packaging in our [community] repository, and am in general pretty interested, so I could help figure issues out even if @felixonmars makes the final calls etc.)

@pradyunsg
Copy link
Member Author

So, right now we have a change in, so that pip won't print an "upgrade me!" message if the "INSTALLER" of pip is not pip -- #5368.

@pradyunsg
Copy link
Member Author

Another thing we might want to do is what @benoit-pierre suggested -- suppressing the message if pip is unvendored.

@eli-schwartz
Copy link
Contributor

Distros might or might not choose to unvendor pip. I guess a more reliable check is whether the INSTALLER metadata is there. Is there a situation where pip is devendored by the distro but installed using itself?

I cannot think of a reason to install pip using pip for distribution packaging, personally -- it works quite well with python setup.py build && python setup.py install --root="$DESTDIR", in which case there will be no INSTALLER. This is what we do in Arch Linux, certainly.
It's also consistent with the general state of packaging python modules for distribution packages for which we use setuptools.

Using pip to install pip would lead to a bootstrap problem, how do you get pip in order to use pip? We currently have no bootstrap issues (I think) other than setuptools, which we use to install everything else (but which depends on packaging and appdirs.)

We try to keep bootstrapping problems to a minimum, because they require additional work to stage temporary bootstrap-only packages that let the build proceed.

@pradyunsg
Copy link
Member Author

#5603 documents the changes discussed here, in the vendoring/debundling documentation.

@nehaljwani
Copy link
Contributor

Why not go one step further and also disable upgrades for packages which were not installed via pip? For example, this is very much possible:

$ rpm -qf /usr/lib64/python2.7/site-packages/nacl
python2-pynacl-1.2.0-2.fc28.x86_64

$ pip freeze
cffi==1.11.5
ply==3.9
pycparser==2.14
PyNaCl==1.2.0
six==1.11.0

$ sudo pip install --upgrade pynacl
...
Successfully installed pycparser-2.18 pynacl-1.2.1

@pradyunsg
Copy link
Member Author

@nehaljwani That's something that we can discuss in a new feature request issue. :)

@pradyunsg
Copy link
Member Author

Thanks for filing #5605; if anyone from this thread wants to chip in over there, they're welcome to. :)

vstinner pushed a commit to fedora-python/python-pip that referenced this issue Sep 20, 2018
This is a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1573755

1. We put "rpm" inside pip's INSTALLER instead of "pip"

2. From pip, we check what's in INSTALLER and only show the warning
   if it's "pip".

When a venv is cearted, pip is installed from wheel (trough rewheel),
INSTALLER contains "pip".

When virtualenv is used, pip is installed from the Interwebz via pip,
so INSTALLER contains "pip".

Upstream issue pypa/pip#5346
@pradyunsg
Copy link
Member Author

I'm going to go ahead and close this -- this issue still has the current reference for @pypa/pip-committers, on who to ping if there's an issue regarding Linux vendors.

@ncoghlan
Copy link
Member

ncoghlan commented May 6, 2019

New issue to start discussing a general purpose _platformhints module to let Python level installers issue queries to the underlying platform: #6468

@pradyunsg
Copy link
Member Author

I'm going to go ahead and close this

I'm slow at clicking buttons. :)

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation OS: linux Linux specific project: <downstream> When the cause/effect is related to redistributors type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

No branches or pull requests

10 participants