Different Python Versions

Hello there.
Is there a possibility to have multiple versions of Python installed alongside on Tumbleweed?

For Ruby there is “RVM”. Is there any chance, I could run Python 3.8 and 3.6 alongside?
Is compiling and putting it to /opt an option?

Thanks in advance for your help :]

Hi,
Unlike many distros, openSUSE provides a basic python maintained by openSUSE as part of its distro.
Many distros instead install Python using packages built and maintained in the official Python PyPi repositories.
This is why many Python packages are available using zypper and YaST Software Manager instead of running the “pip” command.

Yes,
you can install any number of Python side by side with openSUSE, but generally speaking rarely supports any other version than what you already have although it can be enhanced by adding the special openSUSE Python repository for your distro.

If you want to run an altogether different version of Python, since eternity Python has had its own tool called “virtualenv” to manage and invoke multiple python on the same system, and openSUSE supported it fully.
The main thing to know is that openSUSE is co-operating with official Python efforts to deprecate Python 2 and is moving as fast as possible to encourage everyone to use Python 3 instead.
The “new” tool similar to virtualenv that manages multiple Python is Pyenv
You should be able to find pyenv using zypper or YaST Software Manager, but for convenience here is the one-click install for Pyenv
https://software.opensuse.org/package/pyenv

You should know that if you intend to run Python 2, I posted not long ago that the Python 2 plugin to pyenv didn’t work for me.
Was unanswered, so I don’t know if it’s broken or User error (my fault)
https://forums.opensuse.org/showthread.php/540144-Any-python-programmers-out-there-know-how-to-set-up-pyenv-virtualenv
Since the legacy “virtualenv” still works fine, that should be used to support Python 2 until the reasons for my failure are known.

Getting off on a slight tangent…
I don’t know if you have experience with RVM or just mentioned it because you know what it does,
But for various reasons I recommend RBENV instead of RVM and if you had any experience using RBENV you’d find a lot of similarities with pyenv because RBENV was inspired by and works like virtualenv. And then, in circular fashion when pyenv was created it supposedly adopted improvements pioneered by RBENV.
I posted a Wiki on my observations and recommendations installing Ruby using RBENV and why it might be bbetter than RVM
https://en.opensuse.org/User:Tsu2/Install_Ruby

HTH,
TSU

A separate comment…
I see that TW is officially supporting only Python3 3.8.3 today but that numerous people are providing 3.7 and 3.6 through builds in their home repositories…
Without knowing exactly how those are implemented, I’m guessing they’re going to change your entire system and not install side by side.
https://software.opensuse.org/package/python3?search_term=“python3”

So,
My previous post to use pyenv and install any version or number of pythons using pyenv is likely your best solution.
That’s aside from running separate virtual machines, each configured to use a different python.

TSU

Coincidentally, Bradford Linux User Group had a demo of python venv at its meeting on Tuesday: Bradford GNU/Linux Users Group | A self-help group for GNU/Linux, Open Source and Free Software users in and around the Bradford District, West Yorkshire. The text of the example is copied directly from qterminal on Leap 15.2.

Yes, actually venv is another tool.
I’ve forgotten how I made the decision long ago to try to standardize on pyenv instead of venv but…

Here are a few links that compare these tools… Too bad it’s such a complex topic you’ll probably still wonder if you made the right decision

Here is something from the official Python documentation
https://virtualenv.pypa.io/en/latest/

A stackoverflow where various people tried to present the comparisons in different ways

TSU