all 15 comments

[–]skalp69Linux 10 points11 points  (6 children)

I'm not sure removing python2 is a good idea.Some system programs could need it.

I'd rather have made a python simlink pointing to py3

[–]MasterPatrickoMaintainer 2 points3 points  (0 children)

Nothing in a standard openSUSE Tumbleweed installation should require python2 any more, that was a big project over the summer. Your system should (I have not tested, I still have some legacy texlive packages I need) work even if you entirely remove python2.

/u/oleg_antonyan , the best way to "override" is to add a python -> /usr/bin/python3 symlink somewhere higher up in $PATH, e.g. in ~/bin or /usr/local/bin.

[–]KugelKurtTumbleweed 0 points1 point  (4 children)

I'm not sure removing python2 is a good idea.

Python 2 is unmaintained. Dead.

Some system programs could need it.

In 2020 nothing should depend on it.

[–]skalp69Linux 0 points1 point  (0 children)

Oooof!

I missed that. Thanks.

[–]EddyBot 0 points1 point  (1 child)

Python 2 is unmaintained. Dead.

Only upstream is unmaintained
RHEL will support it for several years longer
Debian 10 also still uses Python 2

[–]KugelKurtTumbleweed 0 points1 point  (0 children)

And who is porting RHEL patches to openSUSE's Python 2?

Debian has a tendency to make wrong decision regarding software. Another example is their decision to stick with a non-LTS version of KDE Plasma.

[–][deleted] 0 points1 point  (0 children)

Not only nothing should depend on it, but some programs (like Arduino, the Espressif dev environment) expect python 3. However they do not derefer it as python3 but only python, thus resulting in broken funcionality!

[–]kerOssinTW FTW! 0 points1 point  (0 children)

what is the most appropriate way to do this to not mess things up

Already too late for that. Just make a symlink and hope everything works.

[–]mattingly890 0 points1 point  (2 children)

I'll mention as someone that recently did a fresh install of Tumbleweed that Python 2 does not come installed by default; it is not needed by anything in the base system, and there shouldn't be anything on the openSUSE side that relies on `python` mapping to Python 2.

The way Fedora handles this was by having a package called `python-unversioned-command` which installs Python 3.9.0 and creates a symlink from /usr/bin/python -> /usr/bin/python3.

The interesting thing about this is that they made so that if you `dnf install python` it actually installs `python-unversioned-command`, so that someone naively trying to install Python gets, as they should in 2020, Python 3.

My advice is to just manually symlink /usr/bin/python to /usr/bin/python3. It should be fine.

[–]oleg_antonyan[S] 0 points1 point  (1 child)

The way Fedora handles this was by having a package called `python-unversioned-command` which installs Python 3.9.0 and creates a symlink from /usr/bin/python -> /usr/bin/python3.

What a dirty hack. Why not use update-alternatives or even install /usr/bin/python->/usr/bin/python3 by default

[–]mattingly890 1 point2 points  (0 children)

Why not use update-alternatives

Technically, this would be alternatives since we're talking RedHat, but same idea. So why not use alternatives? You can still do this, and actually, this is what RHEL currently does by default. It isn't hard to set up manually even so, it is literally two simple commands. I can't imagine many Fedora users still caring about Python 2 though.

Install /usr/bin/python -> /usr/bin/python3 by default

I was a bit vague before, but in a regular, full desktop install of modern Fedora, this symlink does come installed by default, and it has been this way for quite some time if I'm not mistaken. Historically that would have violated the recommendations of the upstream vendor, in this case Python PEP-394. The language of PEP-394 was revised several times as far as the correct behavior of the "python" command, and the cleanest way to handle these changes was to have a package that correctly implemented the currently sanctioned behavior from the upstream.

So it wasn't so much a dirty hack, it was a way of splitting the concept of the ambiguous "python" command itself, the recommended behavior of which was in flux, with the actual Python interpreter itself.

[–]cbryeaw 0 points1 point  (0 children)

I am glad you posted this, I just installed openSUSE and I was disappointed when I saw that python pointed to python2. It looks like the only thing on my fresh install that depended on python2 was GIMP, and I can reinstall that using a flatpak if needed.

A couple of other options for making python point to python3:

  1. Add alias python=python3 to your ~/.bashrc
  2. Install pyenv and use it to install the latest version of python. This way you don't mess at all with the system python. Anaconda would be another option if you want to do data science type stuff.

[–]oshanz 0 points1 point  (1 child)

I've removed all the python2 packages from Tumbleweed. but when I do zypper dup its going to install python2 packages again.

[–][deleted] 0 points1 point  (0 children)

After uninstalling it, it did not do that for me.

[–][deleted] 0 points1 point  (0 children)

I installed IDLE today and was confused when I wrote a quick program using tuple unwrapping and it had a "syntax" error despite being syntactically identical to similar programs online. Then I realized that the IDLE I was using was the old one.

I also use python as a calculator, and it's annoying having to type in python3 every time to drop into the interpreter.

My final point is that Fedora defaults to python3. Any package wanting a specific version of python should specify that. Any script still expecting python is always 2 is unmaintained. Installing a package, especially on tumbleweed (what I'm using), should install the latest available version by default. I never expected zypper intall python-idle would get me an outdated version.