User avatar
ben_nuttall
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 228
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridge, UK
Contact: Website

Is pip currently broken in Debain/Raspbian Jessie?

Fri Mar 03, 2017 1:25 pm

I've been having issues with pip the last few days. I don't know what's causing it.

(Note all following examples refer to "pip", but I'm referring to both "pip" for Python 2 and "pip3" for Python 3)

The apt version of pip in Debian/Raspbian Jessie is 1.5.6 and in Stretch (the next Debian release) is 9.0.1. You can update pip to the latest available with:

Code: Select all

sudo pip install pip --upgrade
However, using apt's version of pip (without upgrading) seems to break when installing modules with dependencies.

Can anyone else reproduce this? Try:

Code: Select all

sudo pip install ipython
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero and creator of piwheels

User avatar
DougieLawson
Posts: 35520
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Is pip currently broken in Debain/Raspbian Jessie?

Fri Mar 03, 2017 1:50 pm

Have you tried installing a new version of pip using the bootstrap https://bootstrap.pypa.io/get-pip.py
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
ben_nuttall
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 228
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridge, UK
Contact: Website

Re: Is pip currently broken in Debain/Raspbian Jessie?

Fri Mar 03, 2017 1:51 pm

Yes. That fixes it, but it's equivalent to getting pip to update itself.

The problem is that it seems the pip that ships with Raspbian is broken.
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero and creator of piwheels

User avatar
DougieLawson
Posts: 35520
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Is pip currently broken in Debain/Raspbian Jessie?

Fri Mar 03, 2017 2:09 pm

ben_nuttall wrote: The problem is that it seems the pip that ships with Raspbian is broken.
Probably not borken, it's just an ancient two year old version that doesn't support all the current feechurs and needs of the python repositories. You can blame DebIan's conservative package update policy for that.
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

swfiua
Posts: 1
Joined: Fri Mar 03, 2017 2:45 pm

Re: Is pip currently broken in Debain/Raspbian Jessie?

Fri Mar 03, 2017 2:55 pm

pip has been going through active development. Most distros have some version of this issue.

python -m pip install --upgrade pip

(use the python who's pip you want to upgrade -- eg python3.6 to update pip for python3.6 -- and then use pip3.6 to be sure you are using the right one -- this can be a bit of a minefield)

some of the work is security related: making sure what you download has the same hash as what is on the pypi server etc.

It is probably pining for python 3.6.

This really is the best python ever and great for teaching. Would be good if it were easier to install on raspbian.

f-strings, async and await and faster, small dictionaries all come with python3.6

(it isn't too bad building from source.... but that is just extra hurdles).

John

gkreidl
Posts: 5996
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Is pip currently broken in Debain/Raspbian Jessie?

Fri Mar 03, 2017 3:40 pm

This is not new. I noticed this about a year ago. Updating pip using pip itself solved the issue.

A simple solution might be to add a post install script to the Raspbian package, which updates pip immediately after installation.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
waveform80
Posts: 303
Joined: Mon Sep 23, 2013 1:28 pm
Location: Manchester, UK

Re: Is pip currently broken in Debain/Raspbian Jessie?

Sat Mar 04, 2017 2:32 pm

ben_nuttall wrote:I've been having issues with pip the last few days. I don't know what's causing it.

[snip]

However, using apt's version of pip (without upgrading) seems to break when installing modules with dependencies.

Can anyone else reproduce this? Try:

Code: Select all

sudo pip install ipython
Yup, this seems to be because Debian/Raspbian stable's version of pip (1.5.6) doesn't handle dependency installation order correctly. In this case, part of the dependency tree goes like this:

ipython depends on simplegeneric, which depends on packaging, which depends on six.

So, the installation should do six, then packaging, then simplegeneric, then ipython (amongst all the other packages it's doing). Unfortunately it tries to do simplegeneric first and this breaks. The newer pip handles the dependency order correctly.

Why has this only broken now? I'd guess one of the packages in that list got updated since the last time you tried and either grew some new dependencies or re-ordered the existing ones (if I recall correctly, order of dependencies mattered with the ancient pip - I vaguely recall having to jiggle the order of them in the past to make stuff work on vanilla installs).

Anyway, it's resolvable without having to upgrade the system pip. Install the dependencies it gets wrong yourself first, then try installing ipython. The following ordering is the minimum I could find that still works:

Code: Select all

pip install appdirs
pip install packaging
pip install ipython

User avatar
ben_nuttall
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 228
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridge, UK
Contact: Website

Re: Is pip currently broken in Debain/Raspbian Jessie?

Sun Mar 05, 2017 10:37 am

Awesome. Thanks Dave.

I've had issues with dependency installation before, but only in odd cases. I regularly install ipython with pip on a new Raspbian image and it's never been a problem until now. Like you say, must be a new dependency issue.

I'm not sure there's anything we can do about fixing it, assuming we can't just backport to the stretch version of the package, we'd have to do a post-install script to update it, and I assume that introduces usr/lib and usr/local/bin versions, which is not *proper* for Debian.

I'll ask and see!
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero and creator of piwheels

User avatar
waveform80
Posts: 303
Joined: Mon Sep 23, 2013 1:28 pm
Location: Manchester, UK

Re: Is pip currently broken in Debain/Raspbian Jessie?

Sun Mar 05, 2017 3:27 pm

ben_nuttall wrote:Awesome. Thanks Dave.

I've had issues with dependency installation before, but only in odd cases. I regularly install ipython with pip on a new Raspbian image and it's never been a problem until now. Like you say, must be a new dependency issue.
Indeed - I've had a quick browse through the history of the various packages and it looks like the "packaging" package added a dependency on "six" sometime late last year so that might account for it (can't be certain without going through all of them, and unfortunately I don't have the time to do that, but it's my best guess at the moment).
ben_nuttall wrote:I'm not sure there's anything we can do about fixing it, assuming we can't just backport to the stretch version of the package, we'd have to do a post-install script to update it, and I assume that introduces usr/lib and usr/local/bin versions, which is not *proper* for Debian.

I'll ask and see!
Well, using pip always introduces stuff into /usr/local; it might be worth seeing if the Stretch version handles dependency order correctly. If it does, that might well be worth a backport although there's probably a fair bit that'd need back-porting with it (setuptools and its deps). That's probably better than back-porting ipython which has a huge number of deps (I'm assuming you use "sudo pip install ipython" because the version of ipython shipped with Raspbian is too old for you?)

Return to “Python”