-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip v10 breaks Debian/Ubuntu pip3 command #5221
Comments
thats a debian issue |
on extra note - replacing the system pip using pip is always an act of system-vandalism where the one inflicting it is responsible for the fallout |
I'd suggest you should wait for a proper apt packaged copy of pip 10 from Debian - as @RonnyPfannschmidt says, you shouldn't be using pip to upgrade your system packages... Looks like the Debian pip3 script uses pip's internals, so getting a pip10 compatible fix is definitely up to them (and I'd fully expect them to wait on releasing their pip10 package until they have that sorted). |
Convince the debian/ubuntu people to not vendor and then let rot half their packages, and that'd be a valid argument. |
You can use virtualenv or venv to isolate yourself from the system pip installation. You should not be modifying the package-manager managed files (here the system pip installation) -- I think they don't expect users to modify things -- it is likely not supported by Debian. It's bound to cause issues like this. |
Same issue on Fedora, too. |
@fake-name There were two pre-releases made: |
@fake-name additionally the general suggestion for usage on all distros is - use a virtualenv, don't vandalize the system, and that works - people just font follow it and then wonder when stuff breaks and blame pip there has been plenty of manual and automated testing with virtualenvs which works also in a virtualenv at least there should be no debian made pip3 command - so what the heck are you talking about wrt this breaking in virtualenvs - please provide enough data to actually verify instead of whining about breakages without providing the data needed to verify them pip is volunteer driven, not a company with dozens of employees |
I'm a derp. |
Thanks, hadn't realized that replacing the system pip was a bad idea but it makes sense. However, it would be good UX if pip would not nag about upgrading in that case. Would that be possible? I reckon a lot of people (including me) would just do whatever "the thing" asks them to do. |
@fake-name thanks for following up - its surprisingly common to mismatch the detail issue when a major release has multi-faceted impact and part of it tries to ruin you day |
Distribution vendors could certainly patch pip to remove that warning (or better, replace it with a similar check against the system packages) along with the other patches they make. I'm not sure how base pip could detect that it's running from a system packaged installation without co-operation from the distribution, but if there's a way to do so that's something we could consider (but be aware that in my experience we get as much negative feedback from getting such heuristics wrong as we do from not including heuristics at all...) |
Always prefer "python3 -m pip" over pip3" or even better "/usr/bin/env python3 -m pip" it is safer and allow to avoid this issue with pip10 |
We solved this issue by clear hash in bash: $ hash -d pip Or in dash (sh): $ hash -r pip |
Also hit this issue while building docker images. @RonnyPfannschmidt says "replacing the system pip using pip is always an act of system-vandalism where the one inflicting it is responsible for the fallout", which has 6 thumbs up. I find this to be an especially obtuse comment given that I instructed to do so by pip itself: You are using pip version 8.1.1, however version 10.0.0 is available. If there is some validity to that comment, then the creators of pip should remove this message and I would encourage @RonnyPfannschmidt to raise an issue to that effect and make his case. |
@qacollective - I think the argument here is that the distro's have taken pip, modified it, and re-packaged it into their repositories. As such, it's not really Pypi's fault the message is still there. Most of this is because a bunch of the distros try really really hard to repackage everything into their own package repositories. Mostly, the things then get left to rot. Personally, at least for python on ubuntu, I wish they'd quit it. The version of basically every python package in apt ranges from really, really old to fossilized. Apt is basically useless for python, IMHO. FWIW, I tend to find the best option is to never install the distro pip in the first place, but instead install it manually via |
Always use --user to avoid killing your system /usr/bin/env python3 -m pip intall --user --upgrade pip Should handle most of buggy case and result in the right version of pip being installed in |
I can confirm @standag's solution is working. A bit of background: After the upgrade (pip install -U pip) on a vanilla ubuntu 16.04 (AWS AMI) one gets to the following situation: Even though the proper pip version preceeds the broken one in the PATH, bash still remembers the old one, so when you invoke it just as 'pip', you'll get the old, broken one running. hash-d pip or hash -r solves the issue. |
First, some notes about what happened here on Debian/Ubuntu (and likely a few more Linux Distros):
This issue is caused by, well, both being violated in a way.
Some general tips on Linux:
What's the workaround? @standag's solution is useful when this is caused by bash's caching of executables. hash -r pip # or hash -d pip If you've modified your OS package manager's installation of pip (eg by using
If you're not on Debian/Ubuntu and pip broke for you, try running:
If the above this doesn't resolve your problems, please file a new issue. [edited by @pradyunsg: make it more relevant for linking everyone with similar issues to this comment; update the suggestion to include uninstalling/reinstalling workaround] |
What about solving it outside docker? It's broken in my regular system and the hash command didn't recognize pip. |
I found pip3, version 9.0.1 installed in a virtualenv from a project and copied it to my /usr/bin and it works again. Here are the contents of the pip3 executable for those who would like to fix it themselves as well.
I'm sure all you have to do is save that to a file called pip3, make it executable by running sudo chmod +x ./pip3, run sudo apt remove python3-pip, and then copy it to the bin directory by running sudo cp ./pip3 /usr/bin. |
@fisadev Thanks a lot. Fix option1 really helps. |
pip3 no longer works when updated (see pypa/pip#5221). Also, git clone should create the right folder (or you need to mkdir it first)
See pypa/pip#5221 (comment) Signed-off-by: Benoit Donneaux <[email protected]>
See pypa/pip#5221 (comment) Signed-off-by: Benoit Donneaux <[email protected]>
See pypa/pip#5221 (comment) Signed-off-by: Benoit Donneaux <[email protected]>
is a comment of mental vandalism. As if the person doing the (naive) upgrade is intentionally setting out to damage their own installation... If that were the case, then pip itself shouldn't be nagging the user to upgrade from 9.0.1 to 10.0.1 with every single pip command executed. I myself followed that recommendation and ended up in this mess. Fortunately: Blaming the victim is no answer, though. |
To address the issue I ran...
...and edited debian's provided /usr/bin/pip to replace it with... #!/bin/sh
# GENERATED BY CEFN
python -m pip "$@" and the equivalent for /usr/bin/pip3 (note this invokes python3 instead). #!/bin/sh
# GENERATED BY CEFN
python3 -m pip "$@" ...which brings back full functionality of pip despite the version 10 installed in my site-packages. I guess this will last exactly as long as debian takes to fix it, (or re-break it) by sending an updated python-pip package. Why they didn't use the package main in the first place I don't know. Official versionThe version of pip installed in #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main()) |
I found an unrelated cause of this pip v10 issue. When upgrading pip using a very old system pip (v1.5.6 on Debian Jessie, i.e. oldstable) for which --system is the default, I noticed that incorrect scripts were installed, e.g.
|
#5599 provides information and provides a single location to seek help toward resolving this issue for end users. The comments section of that issue are open for users to discuss specific problems and solutions. :) |
echo "pip3 install --upgrade pip" would not upgrade pip, removing echo and quotations
Maintainer note: Anyone that still gets this issue please see #5599.
debian:9.4
too, same thing happens)Description:
When upgrading pip (to v10) on at least Ubuntu 16.04, the
pip3
command stops working ("cannot import main", see below). This is on a fresh install.What I've run:
(Note that I've stripped out all the apt output etc., since I think it's not needed here. Let me know if you still want it!)
Not sure if this is something that should be fixed on the pip side or on the Debian side.
The text was updated successfully, but these errors were encountered: