[SOLVED] Should Mint 20 upgrade remove /usr/bin/python?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
caian
Level 1
Level 1
Posts: 3
Joined: Thu Nov 21, 2019 6:40 pm

[SOLVED] Should Mint 20 upgrade remove /usr/bin/python?

Post by caian »

Hello all, I just did an upgrade from Mint 19.3 to Mint 20 and I noticed this strange situation where all my scripts depending on 'python' stopped working with:

Code: Select all

/usr/bin/env: ‘python’: No such file or directory
Upon further inspection I saw that the link /usr/bin/python was removed during the update, although the python2 and python3 links are still there. If I remember correctly, python2 is being superseded by python3 as the default python, so it makes sense the upgrade tool would remove the link, but isn't it supposed to remake the link pointing to python3?

Thank you
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
corkie
Level 1
Level 1
Posts: 34
Joined: Tue Aug 14, 2018 2:01 pm

Re: Should Mint 20 upgrade remove /usr/bin/python?

Post by corkie »

I'm in the same boat.

Just to confuse things further there are folders named python and python3 in /usr/share/ with lots of similar complicated looking stuff in them. So maybe you have separate executables for both python and python3 in mint 20. There is nothing there for python 2 so I expect scripts looking for 2 get directed to python 3 executables by some magic I don't understand.

You could do the same for your python scripts. Just change the script in your /usr/local/bin/'broken_thing' folder to point to python3.
i.e. change the line

Code: Select all

#!/usr/bin/python
to

Code: Select all

#!/usr/bin/python3
If that doesn't go well you are back to replacing /usr/bin/python so the script can use the old executables.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Should Mint 20 upgrade remove /usr/bin/python?

Post by smurphos »

Hi - take a look at the Focal release notes - https://wiki.ubuntu.com/FocalFossa/Rele ... by_default

The section on upgraded systems is specific to Ubuntu upgrades not Mint.

If you want to avoid updating your own python scripts you can install either python-is-python2 or python-is-python3 depending on your needs. These packages are mutually exclusive but create the appropriate symlink.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
caian
Level 1
Level 1
Posts: 3
Joined: Thu Nov 21, 2019 6:40 pm

Re: Should Mint 20 upgrade remove /usr/bin/python?

Post by caian »

corkie wrote: Sun Jul 26, 2020 8:57 am I'm in the same boat.

Just to confuse things further there are folders named python and python3 in /usr/share/ with lots of similar complicated looking stuff in them. So maybe you have separate executables for both python and python3 in mint 20. There is nothing there for python 2 so I expect scripts looking for 2 get directed to python 3 executables by some magic I don't understand.

You could do the same for your python scripts. Just change the script in your /usr/local/bin/'broken_thing' folder to point to python3.
i.e. change the line

Code: Select all

#!/usr/bin/python
to

Code: Select all

#!/usr/bin/python3
If that doesn't go well you are back to replacing /usr/bin/python so the script can use the old executables.
Unfortunately these are scripts that I maintain and that should be compatible with both python 2 and 3, so I can't assume python2 or python3 as default. I ended up linking python 3 as the default, but I wanted to know if there is a proper way of doing it as it could break some installation or assumption about the absence of that link.
smurphos wrote: Sun Jul 26, 2020 9:11 am Hi - take a look at the Focal release notes - https://wiki.ubuntu.com/FocalFossa/Rele ... by_default

The section on upgraded systems is specific to Ubuntu upgrades not Mint.

If you want to avoid updating your own python scripts you can install either python-is-python2 or python-is-python3 depending on your needs. These packages are mutually exclusive but create the appropriate symlink.
Thanks for the very useful piece of information. Installing python-is-python3 solved the issue, but interestingly the release notes state that /usr/bin/python is left untouched on upgrades and only fresh installations come without it. I'll mark the question as solved, because of these notes I still wonder if there is something wrong about the Mint upgrade tool.
Locked

Return to “Installation & Boot”