|
|
Subscribe / Log in / New account

Arch Linux drops Python 2

Arch Linux drops Python 2

Posted Sep 23, 2022 16:21 UTC (Fri) by Vorpal (guest, #136011)
In reply to: Arch Linux drops Python 2 by zwol
Parent article: Arch Linux drops Python 2

Not really a bug is it? Scripts should use python3 or python2 explicitly. Plan "python" is for the end user to use.


to post comments

Arch Linux drops Python 2

Posted Sep 23, 2022 16:39 UTC (Fri) by zwol (guest, #126152) [Link] (22 responses)

No, it's a bug.

There is an enormous corpus of scripts (often written decades ago, and never updated since) that use /usr/bin/python or /usr/bjn/env python on the #! line and expect to get v2. There is also an enormous population of *people* who type "python" without thinking about it and expect to get v2. Therefore, when a system has no Python 2 interpreter available, /usr/bin/python MUST NOT[rfc2119] exist and the default PATH MUST NOT contain any executable named "python".

(Yes, PEP 394 says something different. PEP 394 is wrong.)

Arch Linux drops Python 2

Posted Sep 23, 2022 17:31 UTC (Fri) by randomguy3 (subscriber, #71063) [Link] (6 responses)

In RFC2119, MUST NOT, etc, are things an implementation must or must not do in order to conform to a specific standard. What standard are you saying Arch is intending to (and failing to) implement?

Arch Linux drops Python 2

Posted Sep 23, 2022 17:54 UTC (Fri) by Wol (subscriber, #4433) [Link] (5 responses)

Not that I've read any of this, but all these python2 scripts - do they PREdate the standard?

Because if so, then the standard is out of touch with reality, not reality out of touch with the standard :-)

And given that a standard requiring the use of python2 or python3 doesn't make sense in a pre-python3 world, I suspect the former not the latter.

(Oh - and even SIMPLE python2 scripts require effort to convert to python3. I have one such 3rd-party script on my system (that I know about ...))

Cheers,
Wol

Arch Linux drops Python 2

Posted Sep 24, 2022 18:11 UTC (Sat) by NYKevin (subscriber, #129325) [Link] (4 responses)

Python 2 has been end of life for over two years (since 2020-01-01), and deprecated for much longer. At a certain point, IMHO it becomes acceptable (for distros, libraries, upstreams, etc.) to say "if you're still on Python 2, then compatibility is your problem. We won't support it anymore, nor will we go out of our way to make life easy for you." As early as 2011, they wrote PEP 404 explicitly spelling out that "[t]he official upgrade path from Python 2.7 is to Python 3." It's not as if people haven't had adequate warning that something like this was eventually going to happen.

Arch Linux drops Python 2

Posted Sep 24, 2022 20:11 UTC (Sat) by malmedal (subscriber, #56172) [Link] (3 responses)

It's not a problem for things I write for myself.

But I've written various programs for non-programmers and sometimes been surprised to find they were still using them many years later. I'll have to avoid python for this use-case.

Best for longevity has been Tcl, I've programs written early nineties that still works almost unchanged. I believe the only changes were
adding "package Tk" and "package BLT" at one point.

Arch Linux drops Python 2

Posted Sep 24, 2022 21:06 UTC (Sat) by cjcox (guest, #60378) [Link] (2 responses)

Waiting for Python 4 to make everyone's Python 3 garbage.... people will sing a different tune then.

Arch Linux drops Python 2

Posted Sep 25, 2022 2:00 UTC (Sun) by NYKevin (subscriber, #129325) [Link] (1 responses)

You're going to be waiting a long time. Python 3 happened under an exceptional set of circumstances, and given all the pain it caused, nobody is eager to do it again. It's possible that they will make a Python 4, and it's even possible that it will have some minor backwards incompatibility with Python 3. What it will not have is "You have to rewrite all of your string-processing code from the ground up."

Arch Linux drops Python 2

Posted Sep 25, 2022 2:43 UTC (Sun) by jhoblitt (subscriber, #77733) [Link]

Python 4 is out. It is called Go.

Only half joking.

Arch Linux drops Python 2

Posted Sep 23, 2022 23:15 UTC (Fri) by Vorpal (guest, #136011) [Link]

Which standard is this that says that python should not point to python3? PEP 394 as you mentioned clearly allows for the Arch behaviour. Please tell me which PEP contradicts this. From a quick search of PEP titles I cannot find any PEP that overrides PEP 394. "rfc2119" that you quote is just the definition of "MUST NOT", so not relevant. Frankly, unless you can back up that statement I call BS.

And those scripts that expect python to be python2 would be broken anyway on a system without python2, so there is functionally no difference (it is not like any of the scripts are going to actually work but do the wrong thing, they are going to fail outright, or just happen to work, unless explicitly written to create different behaviour).

Oh and I haven't seen a python2 script in years now, so I doubt that much of that "enormous corpus" is still actively used by typical end users. Sure there will be some old server or industrial control machine running some old CentOS version that is no longer supported with python2 scripts. But they are most probably not running Arch anyway.

Arch Linux drops Python 2

Posted Sep 23, 2022 23:32 UTC (Fri) by gerdesj (subscriber, #5446) [Link] (9 responses)

"There is an enormous corpus of scripts (often written decades ago, and never updated since)"

You hold up "never updated since" [decades ago] as something for the world to worry about. Don't think so. If you can't be arsed to update them then they can't complain if the world moves on.

Within that sort of timescale (decades) I've seen fuse boxes (consumer units) have nails and screws substituted for fuse wire to avoid "tripping". That of course leads to far worse potential failures, starting with 240V/16A or 240V/32A crossing a heart and other exciting electrical related outcomes.

If your scripts are important then you patch them according to changing conditions and keep them alive. They need care and feeding. If you are heartless enough to just dump and forget them, then that's your problem.

Python, by a very polite decree, delivered over several years, has decided that it would like to be invoked by its v3 incarnation instead of v2 and so it should be if you want to continue mainstream. Feel free to go your own way - you always have choice. v2 is still available with minimal hassle.

Arch Linux drops Python 2

Posted Sep 24, 2022 14:14 UTC (Sat) by Vipketsh (guest, #134480) [Link] (8 responses)

You write as someone who has never seen a large scale real world deployments -- in theory you are correct, in practice you are wrong. Anyone who has knows full well that there are a plethora of ancient scripts in any deployment which can not be changed without herculean effort for a whole slew of reasons, some sane some moronic but that is not the engineer's choice. Denying this reality is trying to change history that Python2 never actually existed.

> Python, by a very polite decree, delivered over several years, has decided [...]

Whether that's polite or not is relative. For something generally fast changing like network facing scripts that may be considered "polite", but there are other use cases. For example, in the chip-design industry I'm in, it is not uncommon to have to open projects from 10-20 years in the past and do some work on it -- maybe run a simulation to check a customer complaint or maybe even make a fix. If it so happened that some script was written in python2, which was very reasonable at the time, today it does not work and Python's decision can hardly be considered "polite".

One could argue that "just use the same environment as back then", and engineers generally would prefer that, but that is often not possible because the commercial EDA tool vendors need lots of convincing to hand out licenses to tools that old so one is often forced to new tools and environments. EDA vendors typically realise the problem and tend to have quite good backwards compatibility in their tools, but that doesn't solve the script issue.

In the global picture, the only way open source can make general forward progress is if one is able to continue building instead of having to always race to keep up with the latest fads just because someone decides that history needs to be rewritten. Do you think Python would be any good today if every decade it would have to rewrite its interpreter in the programming language of the day ? I'm truly curious because the Python guys seem to think its perfectly fine when they force everyone else to do the same.

Arch Linux drops Python 2

Posted Sep 24, 2022 18:34 UTC (Sat) by Wol (subscriber, #4433) [Link]

> One could argue that "just use the same environment as back then", and engineers generally would prefer that, but that is often not possible because the commercial EDA tool vendors need lots of convincing to hand out licenses to tools that old so one is often forced to new tools and environments. EDA vendors typically realise the problem and tend to have quite good backwards compatibility in their tools, but that doesn't solve the script issue.

That assumes the vendor CAN hand out a licence ...

I've just seen on one of my mailing lists, a request for UniData 5 point something install media. I don't know how old that is, but the current vendor (Rocket) doesn't have a copy. They've taken over most of the Pick vendors, and in the process a lot of history has probably been lost. Trying to get hold of commercial products from that long ago is probably very difficult simply to find an extant copy!

Cheers,
Wol

Arch Linux drops Python 2

Posted Sep 24, 2022 22:32 UTC (Sat) by gerdesj (subscriber, #5446) [Link] (6 responses)

"You write as someone who has never seen a large scale real world deployments" Nice start to a reasoned response.

My nascent Civil Engineering career morphed into IT around 30 odd years back. You will have heard of some of my little firm's customers - strange but likely true.

I own a treasured screwdriver with a wooden handle and a simple flat blade - you may do too. It still works - mine was my great granddad's and was made in the 1880s or so. The handle has many years of skin oils and various other oils and who knows what else infused into it and it has a phenomenal patina which has perfectly preserved it. The metal bit is a masterpiece of forging and heat treatment. The whole thing is chromium infused steel for rust resistance. The shaft is roughly like modern mild steel - it is slightly ductile, which means it deals well with torsion. The blade part has been heat treated in two parts. The whole "blade" has been hardened a bit and the leading edge has been hardened more. The part that you stick in a flat edge screw is as good today as it was 140 odd years back.

I also have my dad's ratchet screwdriver. This one has a wooden handle too and is only 60 odd years old. It works fine too and just needs a light oil every few years or so.

I have several electric drill drivers, one of which you have to ensure you get a leg in the way to avoid wrenching your wrist and a wide set of modern cross head/flat head/insulated screwdrivers and all the rest.

Guess which set of tools I use these days? I maintain the old ones and they still work but a De Walt wrist destroyer with a decent bit is my go to screwdriver.

The above is simply a fun digression but I'm sure we can whistle up an analogy. I think you are missing multiple points:

1. "Entitlement" - Python devs should do what I want them to for my use case.
2. "Laziness" - I can't be bothered to maintain my stuff.
3. "Inertia" - Its always done like this and I want it to last forever.
4. "Lack of imagination" - We can't be arsed with change.

You can always grab a Python2 and maintain it yourself if your code is that important. It's a simple cost/benefit analysis.

Whilst we are at it, we should note that this article is about Arch dumping Python2 not Centos or whatevs it is is called today. I run Arch on my personal laptop and work desktop - I doubt you do on your work gear and so the whole argument is rather moot. I do suggest you plan ahead though.

Arch Linux drops Python 2

Posted Sep 25, 2022 18:21 UTC (Sun) by Wol (subscriber, #4433) [Link] (5 responses)

> My nascent Civil Engineering career morphed into IT around 30 odd years back. You will have heard of some of my little firm's customers - strange but likely true.

As someone who worked in Civil Engineering, I'm not surprised. MOST big firms actually have precious few employees. Most of the work is done by subcontractors. So yes, I probably have heard of quite a few of your customers ...

Before I moved into the HR world, I worked for Babcocks, Costain, Merlin, ... (that I can remember).

Cheers,
Wol

Arch Linux drops Python 2

Posted Sep 26, 2022 23:20 UTC (Mon) by gerdesj (subscriber, #5446) [Link] (4 responses)

"As someone who worked in Civil Engineering, I'm not surprised. MOST big firms actually have precious few employees. Most of the work is done by subcontractors. So yes, I probably have heard of quite a few of your customers ..."

I never even got that far in civ eng. I graduated in 1991, from Plymouth. I applied to Plymouth Poly, attended Poly South West and a year later it was Uni Plymouth. As you will recall, 1991 was not a good year for building stuff in the UK! I rocked a UB40 for a fair old while. I can still whistle up a decent 1-2-3 mix of conc and some of my garden structures are rather more formally designed and analysed than the usual.

My comment about hearing about my customers is for my very little IT company 8) Two of them are rather global and another one: you (as a Brit) will know well.

My main point about Python devs deprecating P2 is that I think it is behaving in an entitled way to try and insist that P2 be maintained forever. Arch is a great platform to test the waters for the change and give off an indication that it will finally happen across the board.

I only trained to become an engineer but I run my work life by what I learned in a few years. It might be nice to see IT grow up and learn that maintenance is part of the design of a system. Some bloke farting around for Facebook once famously said something along the lines of: "work fast and break things". He might now be a multi zillionaire but perhaps he ought to try painting a bridge. You will know that the Forth rail bridge was famously a job never finished. I believe it is now covered in some sort of plastic - but at least that is a proper solution.

My main problem with complaints about deprecating P2 and actually removing it is "entitlement". Either enjoy a better way to coat your bridge (you might need a new applicator and learn how to use it) or keep your old paints and brushes around - at least you have the recipe for the stuff.

Arch Linux drops Python 2

Posted Sep 27, 2022 9:03 UTC (Tue) by Vipketsh (guest, #134480) [Link] (3 responses)

> insist that P2 be maintained forever

For what it's worth, my "change history" comment was referring to the Python people asking for the 'python' command to mean python3. That closes the door to being able to install python2 (originally what 'python' did) and having things just work. It also leaves no indication to anyone new to the Python world that "oh, this is written in a different Python". This causes pain all around for no reason what so ever. Also their stance towards anyone wanting to maintain python2 (a comment below) is simply hostile.

That is the reality of running big systems: there will always be ancient stuff running for "reasons" requiring weird interpreters and that includes Python2. The right thing to do is to admit this is the case, not close the door to anyone wanting to do "this crazy thing" and accept patches if someone puts in the effort to keep Python2 running in modern environments. See ? I'm not asking for anyone to maintain things, just keep the door open to allow people to do necessary things needed in the real world and not make the problem worse.

I also take big offense when people downplay the work needed to fix breakage and try to sell the millionth incompatibility as "this is absolutely necessary" (a big fat lie). That is real time not spent doing real work and across thousands of projects burning many thousands of man hours. The simple reality is that the Python2->3 transition was not liked by many and thus was simply a bad idea. Instead of admitting that was the case the Python crew seem to just push harder that python2 never in fact happened.

From my point of view actions of the Python people are just asking for bad words to be sent in their direction and just aren't making things better.

> It might be nice to see IT grow up and learn that maintenance is part of the design of a system.

This I very much agree with. Even if your foundations don't change (e.g. if Python2->3 never happened), maintenance is very much required. Of course I think this goes both ways: organisations putting up the money/resources for maintenance but also software understanding their dependents will need to be maintained and thus not unnecessarily making things difficult for them.

Arch Linux drops Python 2

Posted Sep 27, 2022 21:14 UTC (Tue) by NYKevin (subscriber, #129325) [Link] (2 responses)

> For what it's worth, my "change history" comment was referring to the Python people asking for the 'python' command to mean python3. That closes the door to being able to install python2 (originally what 'python' did) and having things just work. It also leaves no indication to anyone new to the Python world that "oh, this is written in a different Python". This causes pain all around for no reason what so ever. Also their stance towards anyone wanting to maintain python2 (a comment below) is simply hostile.

My attitude towards this is pretty much identical to the attitude that the C standards committee displayed towards IBM, when the latter asked for trigraphs to be kept in the language for backcompat with EBCDIC: Meh, that's your problem. You can do the symlink dance yourself, or configure your sysadmin automation to do it for you.

I don't mean to be rude. I'm simply stating a fact. You cannot rationally expect people who are not on your payroll to do work that you consider necessary. Reviewing patches is not free. Maintaining VCS branches is not free. Compiling interpreter binaries is not free. All of these things require human attention, computing power, or both. While this may not be a lot of work, it's their decision whether they want to do it or not. It should also be emphasized that you can still download Python 2.7 today, if you really want to: https://www.python.org/downloads/release/python-2718/

Arch Linux drops Python 2

Posted Sep 27, 2022 22:12 UTC (Tue) by Wol (subscriber, #4433) [Link] (1 responses)

> My attitude towards this is pretty much identical to the attitude that the C standards committee displayed towards IBM, when the latter asked for trigraphs to be kept in the language for backcompat with EBCDIC: Meh, that's your problem. You can do the symlink dance yourself, or configure your sysadmin automation to do it for you.

"to be kept" ... in other words, the standards committee was MAKING work for other people. Same here - if people want "python" to *just* *keep* *working*, the python guys are MAKING work for other people.

I get your point - why should the python guys do work for other people. But the point in the other direction is just as valid - why are the Python guys making work for other people?

Cheers,
Wol

Arch Linux drops Python 2

Posted Sep 27, 2022 22:15 UTC (Tue) by NYKevin (subscriber, #129325) [Link]

An interpreter that contains security flaws doesn't work, for any reasonable interpretation of "work." Therefore, keeping Python working would require one of two things:

1. Python does not implement any security boundaries whatsoever. This entails the removal of quite a lot of the standard library (e.g. all of the HTTP and SSL code), which probably breaks a lot of legacy scripts anyway.
2. Someone patches those flaws when they are found.

Arch Linux drops Python 2

Posted Sep 25, 2022 3:20 UTC (Sun) by milesrout (subscriber, #126894) [Link]

Personally, I have expected 'python' to run python 3 for about 10 years. And unless my memory betrays me, that's exactly what it has done on Arch for about that long.

> (Yes, PEP 394 says something different. PEP 394 is wrong.)

I would politely suggest that maybe you are in fact wrong.

Arch Linux drops Python 2

Posted Sep 26, 2022 12:15 UTC (Mon) by agateau (subscriber, #57569) [Link] (2 responses)

I felt similarly for a while, until I found out the official Python 3 Windows installer, does not install a python3.exe binary, so any shebang explicitly referring to python3 fails on Windows.

Shebang lines for Python on Windows

Posted Sep 26, 2022 13:20 UTC (Mon) by rschroev (subscriber, #4164) [Link] (1 responses)

Windows itself does not interpret shebang lines. These days (since Python 3.3) the Python installer installs a utility, the "Python Launcher for Windows" (py.exe), which is configured as the default file association for Python scripts. The launcher does interpret the shebang line (limited to a few common formats) and launches the appropriate python executable.

#!/usr/bin/env python launches the default Python
#!/usr/bin/env python2 launches the most recent Python 2
#!/usr/bin/env python3.9 launches Python 3.9

See https://docs.python.org/3/using/windows.html#python-launc... and more specifically https://docs.python.org/3/using/windows.html#shebang-lines

In a nutshell, this makes it possible to have shebang lines that work on both Windows and Unix-like operating systems.

Shebang lines for Python on Windows

Posted Sep 26, 2022 14:05 UTC (Mon) by agateau (subscriber, #57569) [Link]

Interesting. I never used py.exe. That can be handy, but it would not have helped in my case. We were using Python in our CI and the assumption was: since we start the script from Git Bash, the shebang is going to work properly, because Bash knows about shebangs. And indeed it does, but we still could not write "#!/usr/bin/env python3" because there was no python3.exe file (until we created one by copying python.exe to python3.exe, meh).

I still believe being able to reliably depend on the availability of a python3 binary on all supported platforms would have helped a lot.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds