Page 1 of 1

STICKY: [announcement] python 2 end of life

Posted: Tue Aug 20, 2019 8:48 pm
by plugwash
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.

Re: python 2 end of life

Posted: Tue Aug 20, 2019 8:56 pm
by DougieLawson
This should be a Raspberry Pi blog entry. Nobody will see it here.

Re: python 2 end of life

Posted: Fri Aug 23, 2019 11:27 am
by paddyg
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!

Re: python 2 end of life

Posted: Fri Aug 23, 2019 12:37 pm
by hippy
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.

Re: python 2 end of life

Posted: Fri Aug 23, 2019 1:45 pm
by PeterO
Surely this is an issue for Debian to be sorting out ?
PeterO

Re: python 2 end of life

Posted: Fri Aug 23, 2019 3:40 pm
by bensimmo
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.

Re: python 2 end of life

Posted: Fri Aug 23, 2019 4:10 pm
by DougieLawson
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.

Re: python 2 end of life

Posted: Fri Aug 23, 2019 7:38 pm
by paddyg
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:

Re: python 2 end of life

Posted: Sat Aug 24, 2019 12:00 am
by 2231puppy
RIP Python 2, Home of PyGame.

Re: python 2 end of life

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

Re: python 2 end of life

Posted: Mon Aug 26, 2019 12:26 am
by Andyroo
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

Re: python 2 end of life

Posted: Thu Aug 29, 2019 9:36 pm
by ben_nuttall
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.

Re: python 2 end of life

Posted: Fri Aug 30, 2019 10:27 am
by ShiftPlusOne
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.

Re: python 2 end of life

Posted: Mon Sep 02, 2019 5:13 am
by Heater
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?

Re: python 2 end of life

Posted: Mon Sep 02, 2019 2:39 pm
by jamesh
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.

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

Posted: Thu Oct 10, 2019 9:52 pm
by paddyg
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.

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

Posted: Thu Oct 10, 2019 10:59 pm
by klricks
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.

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

Posted: Sun Oct 13, 2019 8:22 pm
by ben_nuttall
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.

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

Posted: Sun Oct 13, 2019 8:30 pm
by paddyg
I always thought Ubuntu was a Debian derivative the same as Raspbian. Maybe Canonical is big enough to add more tweaks.

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

Posted: Sun Oct 13, 2019 9:39 pm
by rpdom
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.

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

Posted: Wed Oct 23, 2019 12:47 am
by TheTechRobo
Oh shoot, I was programming in Python 2

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

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

Posted: Sat Aug 22, 2020 9:48 pm
by plugwash
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.
Both Ubuntu and Raspbian are derivatives of Debian, but the similarity basically ends there.

Raspbian is basically a 1-person (two initially, but mike doesn't really participate anymore) project that rebuilds Debian for armv6. The only way to stay sane is to keep changes to a minimum.

Ubuntu is a big project with manpower comparable to if-not greater than Debian itself (though it's difficult to compare because many Developers contribute to both). They have their own security team, their own release team, their own release schedule, their own strategic goals and so-on.

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

Posted: Sat Aug 22, 2020 9:57 pm
by plugwash
Update.

As the bullseye freeze draws closer it is becoming more clear what the python 2 picture will look like in bullseye.

It it likely that python 2.7 itself will remain, but the /usr/bin/python symlink is going away. Also the majority of third-party modules and tools are already gone from bullseye. If you want to use pip and virtualenv with python2 in bullseye then you will likely have to install them manually as the packages have been removed.

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

Posted: Sun Aug 23, 2020 11:15 am
by hippy
plugwash wrote:
Sat Aug 22, 2020 9:57 pm
but the /usr/bin/python symlink is going away.
That sounds like it could be a major concern but likely isn't. Python 3 users already have to specify "python3" so this change won't affect them, and that should be the majority of Python users on a Pi these days. Those still using 2.7 will have to get used to specifying "python2", which they should have transitioned to doing anyway, or create the symlink themselves.

It does affect those of us who have code which is compatible with both Python 2 and 3 and have used a "#!/usr/bin/python" shebang as per prior recommendations. The pragmatic solution there is to update the shebang to specify "python3" and leave it to Python 2 users to resolve if that doesn't suit them.

A double shebang, the second being ignored, is one way to let a user know it is Python 3 and Python 2 compatible ...

Code: Select all

#!/usr/bin/python3
#!/usr/bin/python2
print("This is Python 3 and Python 2 compatible")