From what I can tell python2 is still there in the repo, it’s just pip2 that’s missing.
It’s kinda scary to hear that such a widespread package gets removed. I really didn’t expect this to happen on a Linux distro. I mean Linux kinda has a reputation of keeping backwards compatibility to all eternity. Will sh and other wide-spread tools be removed as well?
$ sudo dnf install python2-pip
Fedora 34 - x86_64 - Updates 42 kB/s | 22 kB 00:00
Fedora Modular 34 - x86_64 - Updates 28 kB/s | 23 kB 00:00
No match for argument: python2-pip
Error: Unable to find a match: python2-pip
You might check the repos for those libraries and see if they provide a Python 3 version. I’m guessing they do, and you just need to get them from the source.
Then you can avoid Python 2 altogether.
Lol… Python 3 broke basic I/O. Could you imagine if C suddenly broke fprintf(STDOUT, ...).
But I agree with you about backwards compatibility. The Python 3 interpreter should have included code paths to consume Python 2 I/O. Users should not have to do anything special to print to a terminal, like rewrite code after running 2to3. Python should have shouldered the burden, not users.
Yes, the python2 package is clearly marked “legacy”. it’s there in case someone absolutely needs it but should be avoided if at all possible. It is no longer “widely used”. All of the Python science stack (numpy/scipy…) have dropped support for Python 2 already. Sure, folks are free to keep supporting it, but as far as the Python developers are concerned, Python 2 is EOL.
I think you have the wrong idea. Linux distributions are downstream. If upstream drops support, why and how will Linux distributions still support some software? Who will fix bugs in the tool, for example?
I’ve really never thought of Linux as keeping backwards compatibility till eternity. it’s just that a lot of users tend to be technically advanced enough to be able to keep old tools working (or they get forked and improved), but there’s a limit to how long tools that upstream developers have declared to be deprecated will be kept.
If you haven’t had a look already, here’s the pip page on pypi—it needs python >= 3.6 now.
About sh: as far as I know, it’s a specification, not a tool. On Fedora, it tends to default to bash (but I haven’t done a clean Fedora install in ages so it could point to another shell implementation):
And in general, the answer remains the same: if developers of a tool drop support for a feature etc., so will Fedora. We follow upstream quite closely.
The suggested thing to do here, as noted by the pip 2 docs and Python community docs in general, is to migrate to Python 3 (which has been around long enough now to not be still considered “new”). There’s even 2to3 to help with the migration
It didn’t break basic I/O, it redid how I/O works in Python. That’s why it was a major version release (2 to 3), not a minor or a patch release. There’s only so much you can do while still trying to remain backwards compatible. The Python community is extremely well organised. They do know what they’re doing, and they kept Python 2 support going for ages before deciding to drop it. I mean, look at the overlap between Python 2 and 3 here:
If the developers of ls, cp, rm etc would stop developing them, would Fedora drop support for those as well?
It just seems weird to me. Sure they may have bugs, but those bugs probably have existed for decades and still these tools were extremely helpful. A bug doesn’t make a program useless.
The issue is that thousands of no-longer-maintained projects have been written with a dependency on python2 and asking random users to port them to python3 is quite unrealistic. And expecting the every developer who has ever released a line of python to translate all of it into pyhton3 is unrealistic as well.
If an existing project depending on python2 works perfectly reliable as-is, I don’t see why you’d need to update the interpreter regularly.
A programming language such as python has to constantly be updated as hardware is updated and other things change. Even the c language has changed a lot since its first release over 50 years ago.
A programming language is not even close to the same class as simple shell commands.
A simple shell utility such as ls does not change much over the years as the shell itself is very stable. Tools like those follow the normal linux programming mantra – Do one thing and do it very well.
I am sure that if those very basic command tools you named were to be obsoleted that fedora would follow suit, but I cannot see a reason for such a change. Those basic command tools have been around for ages and the code gets improved to keep them current.
Isn’t Python 2 installed by default in Fedora 34? (Or maybe I’m wrong. So let me know.)
When I try, sudo dnf remove python2, it showed me a lot of dependencies. Mainly GIMP is shown in “dependent packages” and a lot list of “Removing unused dependencies”.
So I guess, I can’t remove python 2
Edit:
What I don’t understand is, when I run --whatrequires command for python2, it doesn’t list out Gimp. I wonder why! Shouldn’t it shows me Gimp when I run that command?
pranav@fedora ~> rpm -q --whatrequires python2
no package requires python2
Click the “show advanced fields” button on the right, and then see the long list of bugs that block this tracker bug (so the tracker bug depends on them). A few packages that still require python 2 will have open bugs blocking this one, which should at the beginning of the list (and not struck-through).
I also have python 2 installed only for Gimp, but an alternative of course is to use the Flatpak from Flathub, and that way we won’t need Python 2 installed on our systems.
One “trick” one can use to see what other packages actually need from a package is to ask rpm what would happen if you removed it. So instead of (or in addition to) rpm -q --whatrequires python2, try rpm -q --test -e python2.
Learn more about ensurepip with python2 -m ensurepip --help or in docs.python.org/2.7/library/ensurepip.html (sorry, new users can only include 2 links in post).
Use ensurepip and install pip systemwide (dangerous)
Note that using ensurepip with sudo can theoretically break other packages in your system that use Python 2, albeit that risk is small, considering that not many such packages are left in Fedora.
hahaha… i feel compelled to point out that all the sniping back-and-forth about python2 and pip and whether its right to include support or blah blah … all of that noise was shown to basically be worthless, two months later, when someone who actually knows what he’s talking about posted re: ensurepip
@mathcrimes I feel compelled to point out that this method will break eventually if it hasn’t already. Because as the other posters have pointed out, the python2 package will be removed as well.
It still doesn’t feel right to me… Python2 works and it always has worked, python2 has bugs and it always had bugs. If python2 works now and we don’t touch it, it will still work tomorrow. And even if not, I’m sure many volunteers would be willing to ensure it does.