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

Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 2:15 pm

see https://pythonclock.org/

I had assumed that, at some point early in 2019, typing ``python`` on the command line would stop producing python2 and start producing python3. Similarly ``pip`` would stop meaning pip2 and start meaning pip3, idle would mean idle3 etc etc. Presumably that's what will happen in a few months time?

I know that this is a horrible mess and far from trivial to sort out. However every month that passes represents thousands of novice coders unwittingly setting off in the wrong direction and becoming frustrated and confused. Debian, for some reason, took the decision to make python mean python2 but I think the Pi Foundation could take the initiative and push back against that lunacy.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

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

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 2:25 pm

paddyg wrote:
Sat Jun 01, 2019 2:15 pm
see https://pythonclock.org/

I had assumed that, at some point early in 2019, typing ``python`` on the command line would stop producing python2 and start producing python3. Similarly ``pip`` would stop meaning pip2 and start meaning pip3, idle would mean idle3 etc etc. Presumably that's what will happen in a few months time?

I know that this is a horrible mess and far from trivial to sort out. However every month that passes represents thousands of novice coders unwittingly setting off in the wrong direction and becoming frustrated and confused. Debian, for some reason, took the decision to make python mean python2 but I think the Pi Foundation could take the initiative and push back against that lunacy.
I will have to find a link but my understanding is python will always and forever invoke python 2 and never will be used for python3... python4 ...etc.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

jahboater
Posts: 4454
Joined: Wed Feb 04, 2015 6:38 pm

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 2:46 pm

paddyg wrote:
Sat Jun 01, 2019 2:15 pm
Debian, for some reason, took the decision to make python mean python2 but I think the Pi Foundation could take the initiative and push back against that lunacy.
The Debian Python policy:

https://www.debian.org/doc/packaging-ma ... thon3.html

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

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 2:50 pm

But on page 2 they say ``the binary package python will represent the current default Debian Python 2 version.`` how does that fit with their intention to just support the python3 stack!!??

But other flavours of linux (redhat, arch, etc) don't necessarily follow the same line and python users don't have to put up with that. The breaking changes from 2 to 3 were enough of a warning that I'm pretty sure future versions will not break existing applications. Other languages have a progression of versions but someone just starting out in javascript, say (but could be C#, java, etc etc) wouldn't expect it to default to an old version that was no longer supported and incompatible with the latest one.
Last edited by paddyg on Sat Jun 01, 2019 3:39 pm, edited 1 time in total.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

pcmanbob
Posts: 6247
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 2:59 pm

klricks wrote:
Sat Jun 01, 2019 2:25 pm

I will have to find a link but my understanding is python will always and forever invoke python 2 and never will be used for python3... python4 ...etc.
From this document https://www.debian.org/doc/packaging-ma ... ython.html

Chapter 2

At any given time, the binary package python3 will represent the current default Debian Python 3 version; the binary package python will represent the current default Debian Python 2 version.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

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

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 3:16 pm

So when I used the word lunacy I meant a policy that can say
The long term goal for Debian is to reduce this to one stack, dropping the Python 2 stack at some time; the binary package python will represent the current default Debian Python 2 version
Presumably that means that in the near future people buying a new Raspberry Pi will be posting questions on this forum "Help, python doesn't seem to be installed on my version of raspbian" to which the answer will be "You have to type python3"
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

pcmanbob
Posts: 6247
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 4:01 pm

paddyg wrote:
Sat Jun 01, 2019 3:16 pm
Presumably that means that in the near future people buying a new Raspberry Pi will be posting questions on this forum "Help, python doesn't seem to be installed on my version of raspbian" to which the answer will be "You have to type python3"
Don't think we will be have that problem for a while.
Debian has made the decision to ship Python 2 with Debian 10 ("buster"), which will be released in mid-2019; that means Python 2 will be supported in Debian well past its 2020 end of life.
https://lwn.net/Articles/756628/

we do see it occasionally see it even now because both IDLE and Thonny default to python 3 now, were as tutorials were written when python
( python 2 ) was the default.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

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

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 6:34 pm

paddyg wrote:
Sat Jun 01, 2019 3:16 pm
So when I used the word lunacy I meant a policy that can say
The long term goal for Debian is to reduce this to one stack, dropping the Python 2 stack at some time; the binary package python will represent the current default Debian Python 2 version
The key phrase there is "long term goal". That's the goal but we'll have to wait and see how easily achievable they find that is.
paddyg wrote:
Sat Jun 01, 2019 3:16 pm
Presumably that means that in the near future
I'm not sure that long term goal is going to arrive in the near future, but ...
paddyg wrote:
Sat Jun 01, 2019 3:16 pm
people buying a new Raspberry Pi will be posting questions on this forum "Help, python doesn't seem to be installed on my version of raspbian" to which the answer will be "You have to type python3"
Yes.

My expectation is that when Debian drops Python 2, typing "python" will illicit a "-bash: python: command not found" error or a more useful "You will need to use Python 3 or install Python 2 from somewhere" type message if they provide an ersatz Python 2 executable.

I don't see that being problematic. Every Python 3 user using the command line already has to type "python3", not "python". There is no change.

If Python 3 users are typing "python" then they are doing it wrongly whether Python 2 exists or not.

I really don't see there being any problems. Python 3 users will keep on typing "python3" and Python 2 users will keep on typing "python". It's only Python 2 users who will, someday, be affected by a different outcome than may be expected.

And that can be minimised by encouraging existing Python 2 users to start typing "python2", and everything will just be fine if support for Python 2 is dropped, but it can be installed from somewhere and accessed by typing "python2".

I don't believe there's any need to panic, don't believe there's any emergency action needs to be taken. So long as Raspbian tracks Debian, it will all just happen and most people will be none the wiser, most won't notice any change.

jahboater
Posts: 4454
Joined: Wed Feb 04, 2015 6:38 pm

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 8:19 pm

alias python=python3

in the .bashrc file solves the problem forever.

User avatar
scruss
Posts: 2265
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 9:10 pm

When SciPy stops having to jump through hoops to support Fortran 77 — a language standard superseded more than a quarter of a century ago — then it might be time to worry about python calling Python 3 vs Python 2.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

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

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 10:55 pm

I think your and our definition of emergency may differ.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: Emergency Action Required by RPi Foundation

Sat Jun 01, 2019 11:10 pm

jamesh wrote:
Sat Jun 01, 2019 10:55 pm
I think your and our definition of emergency may differ.
It would be good if Buster made python3/pip3 the system-wide default version (so you have to make an effort to deliberately run python2/pip2) as that would reduce the number of "my python program doesn't work" threads created on here.

I'd guess that DebIan are going to bury their collective pythonic heads in the sand until DebIan Bullseye emerges in 2021 (after python2 expires in seven months time in 2020).
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 12:27 am

Thing is...

I suspect that there is a pile of other packages in Debian that depend on Python that will break when they find themselves running Python3 instead of Python2.

So making it a system wide default may not be happening for a long while. Not until everything else is Python3 tolerant. Which means when the upstream projects have adapted all their stuff and the Debian maintainers have tested it all.

I think this is far from being an "emergency".

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 1:40 am

hippy wrote:
Sat Jun 01, 2019 6:34 pm
paddyg wrote:
Sat Jun 01, 2019 3:16 pm
So when I used the word lunacy I meant a policy that can say
The long term goal for Debian is to reduce this to one stack, dropping the Python 2 stack at some time; the binary package python will represent the current default Debian Python 2 version
The key phrase there is "long term goal". That's the goal but we'll have to wait and see how easily achievable they find that is.
Already in buster we are seeing a number of packages drop python2 support compared to stretch. Other packages have had to have the python2 and python3 versions split to separate source packages because upstream has dropped python2 support.

I suspect that buster will be the last release with a mostly-complete python2 stack. Whether bullseye will ship with no python2 stuff at all or whether there will be some vestiges of a python2 stack still around remains to be seen.

ankith26
Posts: 101
Joined: Mon Mar 25, 2019 11:08 am
Location: Earth
Contact: Website

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 6:04 am

but the bigger question is, who uses python2 nowadays....
I am sure that python2 will become a forgotten memory within 5 years

I myself was confused for a while when i ran python and noticed my python3 code did not work on terminal when it worked on idle
Best solution(for now) would be call python as python2 itself.. that way some confusion is gone.
later when python2 is completely gone ,(assuming python 4 does not come out)- we can refer to python3 as python itself
My website is at https://pratt.ml
Hope it runs (which it wont)

User avatar
Imperf3kt
Posts: 2405
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 8:08 am

ankith26 wrote:
Sun Jun 02, 2019 6:04 am
but the bigger question is, who uses python2 nowadays....
I am sure that python2 will become a forgotten memory within 5 years
I use Python 2 exclusively and do not have any need to move on to Python 3.
It has its uses.
Google is ubiquitous - Try it today, it's free!
https://opensource.com/life/16/10/how-ask-technical-questions

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 8:26 am

ankith26 wrote:
Sun Jun 02, 2019 6:04 am
but the bigger question is, who uses python2 nowadays....
I am sure that python2 will become a forgotten memory within 5 years
The problem is that while python remains an alias for python2 (and therefore the default interpreter) then all naïve users will continue to fall into the python2 trap.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 11:12 am

Imperf3kt wrote:
Sun Jun 02, 2019 8:08 am
ankith26 wrote:
Sun Jun 02, 2019 6:04 am
but the bigger question is, who uses python2 nowadays....
I am sure that python2 will become a forgotten memory within 5 years
I use Python 2 exclusively and do not have any need to move on to Python 3.
It has its uses.
What can it do that Python3 cannot?
Other than having to write the code a bit differently.

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 11:16 am

When Buster was first being made, I think they had the intention of trying to leave Python2.7 behind, with Stretch they already made a lot of it Python3.x capable and Buster most if not all of it.
It is probably being left in as a just incase sort of thing, which is wise given there is a lot of code there.

It's not as if it is going to vanish anymore than BASIC will vanish.

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 12:17 pm

bensimmo wrote:
Sun Jun 02, 2019 11:12 am
Imperf3kt wrote:
Sun Jun 02, 2019 8:08 am
ankith26 wrote:
Sun Jun 02, 2019 6:04 am
but the bigger question is, who uses python2 nowadays....
I am sure that python2 will become a forgotten memory within 5 years
I use Python 2 exclusively and do not have any need to move on to Python 3.
It has its uses.
What can it do that Python3 cannot?
Run the exact same code a lot quicker than Python 3 does.

For some cases 3 is faster than 2 but it depends very much on exactly what one is doing. For me 3 has proven to be 30%-50% slower than 2.

To attain anywhere near the same speed of execution under 3 as with 2 I would have to do an awful lot of optimisation, and that's hard work and effort I can do without when I can simply run 2 instead of 3.

That's why I have stuck with 2 and will likely continue to do so even when 2 is no longer officially supported and when the binaries don't come pre-installed.

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 12:43 pm

OK I admit it's not really an emergency as such. It's just that an awful lot of people getting into 'making' aren't coders and choose python because it's accessible and (relatively) easy to get the hang of. A non-negligible proportion of questions I've answered on this forum and elsewhere have had the python 2v3 installation as root cause.

I'm quite happy to keep python2 in the distribution indefinately but I think the default should be 3. Maybe it would be possible to change the shebangs in all the debian scripts that need python2 to ask for it explicitly.

(hippy, py2 is faster than py3 for integer arithmetic and possibly something else but marginal differences in execution speed are never an issue with python!.. as numba, cython and numpy are so easy to include)
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

jahboater
Posts: 4454
Joined: Wed Feb 04, 2015 6:38 pm

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 2:28 pm

paddyg wrote:
Sun Jun 02, 2019 12:43 pm
(hippy, py2 is faster than py3 for integer arithmetic and possibly something else but marginal differences in execution speed are never an issue with python!.. as numba, cython and numpy are so easy to include)
A simple one line "hello world" program takes 22,190,895 instructions for Python2 and 34,291,132 instructions for Python3

Not that I care, I don't expect any Python to be fast.
If I want a program to be fast I would choose a compiled language (in C, hello world takes just 191,680 instructions!)

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

Re: Emergency Action Required by RPi Foundation

Sun Jun 02, 2019 4:25 pm

paddyg wrote:
Sun Jun 02, 2019 12:43 pm
(hippy, py2 is faster than py3 for integer arithmetic and possibly something else but marginal differences in execution speed are never an issue with python!.. as numba, cython and numpy are so easy to include)
For me, my code is fast enough using Python 2, it's only Python 3 which isn't.

I don't believe it's just an integer issue. What investigations I did seemed to show it to be related to file I/O. However I didn't do much investigation as I didn't need to solve a problem I don't have :P

To be honest my code is fast enough using Python 2 or 3 when run on a PC; it only becomes an issue when I'm running that on my Pi. Anything under a second on my PC is good enough for me, five seconds using Python 2 on a Pi is tolerable, once it's stretching beyond that using Python 3 it starts to annoy. So I just don't use 3. Problem solved.

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

Re: Emergency Action Required by RPi Foundation

Mon Jun 03, 2019 9:14 am

This is not a performance comparison thread. Please keep on topic. Some posts deleted.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: Emergency Action Required by RPi Foundation

Mon Jun 03, 2019 9:38 am

DougieLawson wrote:
Sun Jun 02, 2019 8:26 am
The problem is that while python remains an alias for python2 (and therefore the default interpreter) then all naïve users will continue to fall into the python2 trap.
Quite.

But the main issue is that there are a large number of packages in the Debian/Raspbian repositories that use Python. Some of those may specify "python2" in the code, which is fine, some may specify "python3", which is also fine. Quite a few will just specify "python", which is where the problem lies. The Debian team will have to sift through all the packages to find the ones that do that and then ask the maintainers of each package to see if they can get it changed. This may mean feeding a change request back to the authors of the package, or, if that fails, looking into either a local patch, forking the package, or dropping it entirely.

Whichever method is used, it is a huge amount of work and not surprising that it is taking a long time. Until that is complete, "python" must point to python2 for compatibility, otherwise things will start failing.

The RPF aren't responsible for the Debian packages which Raspbian is based on. They have released some modified packages in certain cases to improve performance with the Pi or to address issues with hardware, but they don't have the manpower to do this work. Debian does, but, as I said before, it will take time. Hopefully it will be complete by the time Debian bullseye is released as "stable" in maybe a couple of years.

Return to “Python”