plugwash
Forum Moderator
Forum Moderator
Posts: 3462
Joined: Wed Dec 28, 2011 11:45 pm

STICKY: [announcement] python 2 end of life

Tue Aug 20, 2019 8:48 pm

As many (but not all) of you are probably aware python 2 reaches upstream end of life at the start of next year.

Debian has begun the process of phasing out python 2. In buster there is still a wide selection of python 2 packages, though some have been dropped. Since the release of buster the phaseout process has stepped up a gear. It is hoped that it will be possible to release bullseye without python 2 at all. That may or may not be achieved, but even if python 2 is still present the selection of python 2 packages is likely to be much smaller in bullseye than in buster.

If you are doing new development in python make sure you are using python 3. If you have existing code that you intend to keep using you also need to look into migrating it.

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

Re: python 2 end of life

Tue Aug 20, 2019 8:56 pm

This should be a Raspberry Pi blog entry. Nobody will see it here.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil 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
paddyg
Posts: 2387
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: python 2 end of life

Fri Aug 23, 2019 11:27 am

I posted on the topic a while ago with a rather hyperbolic title including the word 'emergency'. However I do think that something more proactive is needed beyond warnings. Most people starting to program will just use 'python' without worrying about the finer points. I think the maintainers of raspbian should make it as difficult as possible to 'accidentally' use python2 either with warning message or other means.

If you look here: https://python3statement.org/ you will see module maintainers that have pledged to stop maintaining python2 compatible versions of their code by the end of December 2019 at the latest i.e. some will be making (or will have made) the current release the last to be tested with python2. The list includes virtually every common add-on module for python.

I, for one, have already pushed testing pi3d with python2 to a low priority, cursory final check and most developers are desperate to ditch it completely!
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: python 2 end of life

Fri Aug 23, 2019 12:37 pm

paddyg wrote:
Fri Aug 23, 2019 11:27 am
I think the maintainers of raspbian should make it as difficult as possible to 'accidentally' use python2 either with warning message or other means.
The first thing would be to direct the "python" command to running Python 3, and the second would be to not have Python 2 pre-installed.

I guess that rests on Raspbian/Debian being able to actually do that.

It would IMO also be desirable if Python2 were still installable, and any apt-get Python 2 packages remained available for some time after.

Most important of all I feel is having clear definitive statements on exactly what will happen and when, but that doesn't seem possible at present.

User avatar
PeterO
Posts: 5066
Joined: Sun Jul 22, 2012 4:14 pm

Re: python 2 end of life

Fri Aug 23, 2019 1:45 pm

Surely this is an issue for Debian to be sorting out ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
bensimmo
Posts: 4182
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: python 2 end of life

Fri Aug 23, 2019 3:40 pm

PeterO wrote:
Fri Aug 23, 2019 1:45 pm
Surely this is an issue for Debian to be sorting out ?
PeterO
It is and Raspbian/RPD has already moved the Desktop over to Python3 and have anything python(2) as hard to get as as possible.

It's pretty much only command line users not typing a 3 at the end of python.

After that as you say, it's Debian. People will have to follow what they decide.with the next release.

But this is a good honest telling people to get ready and move on to Python3 if you're using Raspbian and intended to in the future.

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

Re: python 2 end of life

Fri Aug 23, 2019 4:10 pm

It would be better if /usr/bin/python pointed to /usr/bin/python3 (rather than /usr/bin/python2 or one of the hundreds of symbolics links) and you had to type the extra "2" to get python2. But I'd guess changing that would break too many things.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil 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
paddyg
Posts: 2387
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: python 2 end of life

Fri Aug 23, 2019 7:38 pm

Sadly I don't think there is a simple solution. And the RPi approach is really "everyone's a command line user", even very basic tutorials start out with "open a terminal and type..." followed by possible misapplication of pip v. pip3 or python-xmodule v. python3-xmodule etc etc.

Maybe what's needed is an LXTermial hack (that can be switched off by accomplished users) that spots when a new user is typing pip or python and pops up a helpful suggestion. It could even have an animated paperclip or such-like. :twisted:
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

2231puppy
Posts: 9
Joined: Sat Mar 09, 2019 11:02 pm
Location: Annanale, VA, USA

Re: python 2 end of life

Sat Aug 24, 2019 12:00 am

RIP Python 2, Home of PyGame.

User avatar
rpdom
Posts: 15360
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: python 2 end of life

Sat Aug 24, 2019 5:47 am

2231puppy wrote:
Sat Aug 24, 2019 12:00 am
RIP Python 2, Home of PyGame.
PyGame is available for Python3.

Andyroo

Re: python 2 end of life

Mon Aug 26, 2019 12:26 am

Python's End-of-Life date is 129 days away, warns the UK National Cyber Security Centre (NCSC). "There will be no more bug fixes, or security updates, from Python's core developers."
Quote from Slashdot here

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

Re: python 2 end of life

Thu Aug 29, 2019 9:36 pm

Thanks plugwash

People talking about moving Python 3 to /usr/bin/python please read PEP-394 https://www.python.org/dev/peps/pep-0394/

piwheels.org has never supported Python 2 - so installing packages with pip is lightning fast for Python 3 users only.
paddyg wrote: Maybe what's needed is an LXTermial hack (that can be switched off by accomplished users) that spots when a new user is typing pip or python and pops up a helpful suggestion. It could even have an animated paperclip or such-like. :twisted:
This is what Ubuntu does! https://twitter.com/ben_nuttall/status/ ... 5200169989
hippy wrote: It would IMO also be desirable if Python2 were still installable, and any apt-get Python 2 packages remained available for some time after.
The EOL was supposed to be 2015, but support was extended by five years. People have had *plenty* of notice.
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero and creator of piwheels

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6021
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: python 2 end of life

Fri Aug 30, 2019 10:27 am

A bit more information about Debian's plans:
https://lists.debian.org/debian-python/ ... 00080.html
https://wiki.debian.org/Python/2Removal
https://alioth-lists.debian.net/piperma ... 00400.html

They've started notifying package maintainers that their packages will be removed from the next release if they depend on python2 in any way.

Heater
Posts: 13595
Joined: Tue Jul 17, 2012 3:02 pm

Re: python 2 end of life

Mon Sep 02, 2019 5:13 am

Imperf3kt,
I'm not moving to Python3 as I dislike it.
I'm curious. What is it about Python3 that you dislike so much? As far as I can tell the differences between 2 and 3 are not big and not much needs changing to get your old code running with 3.
I'll stick with my perfectly functional Python2
Let's hope you are not doing anything serious in Python that requires security.
Sounds like something Microsoft would pull.
That is absurd.

MS is a for profit corporation worth billions, with thousands of programmers, selling software commercially. Debian is a a bunch of people providing you with a Free and Open Source operating system and thousands of prepackaged applications for free. They do it in for no pay voluntarily.

Are you really expecting them to do what you want for nothing? Do you really expect them to take on the work for you of maintaining a huge obsolete project, abandoned by it's owners, and ensuring a secure OS can be built with it?
Memory in C++ is a leaky abstraction .

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23869
Joined: Sat Jul 30, 2011 7:41 pm

Re: python 2 end of life

Mon Sep 02, 2019 2:39 pm

OK, this is an announcement thread. It announces that, completely outside of RPF control, Python 2 is being dropped. This deprecation was announced MANY YEARS AGO, and is completely outside the scope of RPF. So if you want to complain about it, go elsewhere. It's nothing to do with us.

Deleted posts to tidy this announcement up.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

User avatar
paddyg
Posts: 2387
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: STICKY: [announcement] python 2 end of life

Thu Oct 10, 2019 9:52 pm

paddyg wrote:
Maybe what's needed is an LXTermial hack (that can be switched off by accomplished users) that spots when a new user is typing pip or python and pops up a helpful suggestion. It could even have an animated paperclip or such-like. :twisted:

This is what Ubuntu does! https://twitter.com/ben_nuttall/status/ ... 5200169989
If Ubuntu does this why can't Raspbian? Canonical is less 'beginner programmer' oriented than the Raspberry Pi Foundation, after all. There still seems to be constant stream of people asking for help on this forum because they have unwittingly used python. And that turned out to be different from what they intended.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: STICKY: [announcement] python 2 end of life

Thu Oct 10, 2019 10:59 pm

Has Debian decided how they are going to handle the python command?
According to this link (posted by ben_nuttall above): https://www.python.org/dev/peps/pep-0394/ the distribution maintainers will need to decide what they want to do if anything. So until they do we can't assume that the python command will link to python3 in the future.

From the above link:
Distributors may choose to set the behavior of the python command as follows:

python2,
python3,
not provide python command,
allow python to be configurable by an end user or a system administrator.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

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

Re: STICKY: [announcement] python 2 end of life

Sun Oct 13, 2019 8:22 pm

paddyg wrote:
Thu Oct 10, 2019 9:52 pm
If Ubuntu does this why can't Raspbian?
Debian releases are every 2 years, and Python 2.7 was still in life when Buster was released. It's not going to be dropped from Buster mid-life. Come the next Debian release (Bullseye), Python 2 will be dropped from the image, and I imagine Debian will do something with the "python" command as I said Ubuntu have done.
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero and creator of piwheels

User avatar
paddyg
Posts: 2387
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: STICKY: [announcement] python 2 end of life

Sun Oct 13, 2019 8:30 pm

I always thought Ubuntu was a Debian derivative the same as Raspbian. Maybe Canonical is big enough to add more tweaks.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
rpdom
Posts: 15360
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: STICKY: [announcement] python 2 end of life

Sun Oct 13, 2019 9:39 pm

paddyg wrote:
Sun Oct 13, 2019 8:30 pm
I always thought Ubuntu was a Debian derivative the same as Raspbian. Maybe Canonical is big enough to add more tweaks.
Raspbian is pretty much a straight recompilation of Debian Stable (currently Buster), with a load of Pi specific bits added.

Ubuntu is a mixture of packages from Debian Stable, Testing and Unstable, with a load of custom tweaks and stuff. Some of those tweaks eventually find their way into Debian via upstream sources.

TheTechRobo
Posts: 8
Joined: Fri Jan 26, 2018 9:23 pm

Re: STICKY: [announcement] python 2 end of life

Wed Oct 23, 2019 12:47 am

Oh shoot, I was programming in Python 2

Looks like I'll have to do a lot of rewriting! :D
Sent from TheTechRobo

Return to “Python”