How to manage python's version?

, , ,

I’m currently using Fedora 39.
The first installation of Fedora was F36, then I upgraded to F37, then F38 then F39.

On my system, I have 3 versions of python:

/usr/bin/python
/usr/bin/python3
/usr/bin/python3.12

and (for pip)
/usr/bin/pip
/usr/bin/pip3
/usr/bin/pip-3
/usr/bin/pip3.12
/usr/bin/pip-3.12

Since I haven’t installed python manually, why are there so many versions installed?

Can I clean it all up and keep only the latest one?
How do you uninstall older versions?
What are the consequences?

I do this request because when I retrieve third-party tools or make updates, I never know which version of pip Ihave to use. I’m also having problems with version conflicts and dependencies (especially with the latest version of openIA whisper).

Thanks à lot in advance for you help.
Regards

Those are all the same, more correctly: they point to the same version. You can check e.g. with python --version.
They are there so that you can address a specific version (in your scripts) if you need to, but can use convenient shortcuts when you want or if yoy do not care about the specific version in your script.

1 Like

thanks for your quick answer.

> python --version
Python 3.12.0

and pip

>pip --version
pip 23.2.1 from /usr/lib/python3.12/site-packages/pip (python 3.12)

so, my problem with openIA whisper’s dependencies must have antohers causes

thank again for your help

The cause is here

 # ls -l /usr/bin/pip*
-rwxr-xr-x. 1 root root   221 Aug  3 19:00 /usr/bin/pip
lrwxrwxrwx. 1 root root    10 Aug  3 19:00 /usr/bin/pip-3 -> ./pip-3.12
-rwxr-xr-x. 1 root root   221 Aug  3 19:00 /usr/bin/pip3
lrwxrwxrwx. 1 root root     9 Aug  3 19:00 /usr/bin/pip-3.12 -> ./pip3.12
-rwxr-xr-x. 1 root root   221 Aug  3 19:00 /usr/bin/pip3.12

 # ls -l /usr/bin/python*
lrwxrwxrwx. 1 root root     9 Oct  1 19:00 /usr/bin/python -> ./python3
lrwxrwxrwx. 1 root root    10 Oct  1 19:00 /usr/bin/python3 -> python3.12
-rwxr-xr-x. 1 root root 16192 Oct  1 19:00 /usr/bin/python3.12
-rwxr-xr-x. 1 root root    62 Oct  1 19:00 /usr/bin/python3.12-config
-rwxr-xr-x. 1 root root  3079 Oct  1 19:00 /usr/bin/python3.12-x86_64-config
lrwxrwxrwx. 1 root root    17 Oct  1 19:00 /usr/bin/python3-config -> python3.12-config
-rwxr-xr-x. 1 root root   980 Jul 20 19:00 /usr/bin/python3-html2text
lrwxrwxrwx. 1 root root     3 Jul 21 19:00 /usr/bin/python3-sip -> sip

There are several different links created so the upgrade actually allows scripts to function without breaking due to the version change.

what is that about? What python version is required. If python3.12 is not supported, you should use a virtual environment.

I’ve been wondering about the number of different versions of python for a while, and I didn’t really understand how it worked. I understand better now.

Concerning Whisper, I’m having problems with conflicts when updating or reinstalling. But these don’t seem to come from python. OpenIA provides a link but I don’t understand (English is not my native tongue, and Idont understand explanations).

The conflict is caused by:
    openai-whisper 20231106 depends on triton==2.0.0
    openai-whisper 20231105 depends on triton==2.0.0
    openai-whisper 20230918 depends on triton==2.0.0
    openai-whisper 20230314 depends on triton==2.0.0
    openai-whisper 20230308 depends on triton==2.0.0
    openai-whisper 20230307 depends on triton==2.0.0
    openai-whisper 20230306 depends on triton>=2.0.0.dev20221202
    openai-whisper 20230124 depends on torch
    openai-whisper 20230117 depends on torch

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

'm not sure that using a virtual environment will solve the problem (and I wouldn’t know how to do it anyway).

This looks like you’re trying to install openai-whisper with pip?

If the package is indeed not compatible with Python 3.12, you can initialize and use a Python 3.11 virtualenv like this:

sudo dnf install python3.11
python3.11 -m venv venv-3.11
source venv-3.11/bin/activate
pip install openai-whisper

If Python 3.12 is not the actual problem, you could try a clean Python 3.12 environment like this:

python3 -m venv venv-3.12
source venv-3.12/bin/activate
pip install openai-whisper

If this succeeds, then there’s likely something wrong with the Python packages that you installed locally / globally for your account (which is why virtualenvs are a good idea).

1 Like

it properly works with Python 3.11 virtualenv.

I found some documentation about virtualenv. I have a better understanding of how these virtualenvs work and how to manage them.

Thank you very much for taking the time to respond to this non-Fedora related topic.