Here is another post that is definitely not intended for a general audience. It discusses the conflict between the python-is-python3
and python-is-python2
packages when installing TortoiseHg and Oracle Virtual Box on Mint 20.1. Without doubt the source of the problem is the simultaneous presence of versions 2.7 and 3.8 of the Python interpreter and the ambiguity of the python
command.
The python-is-python2
package adds a symbolic link named python
to python2
which ultimately is translated to python2.7
. Likewise, the python-is-python3
packages adds a symbolic link also named python
to python3
and hence to python3.8
. Clearly, these two packages are mutually exclusive.
According to the dpkg
journal, the installation of Virtual Box version 6.1.18 on April 3 was immediately preceded by the installation of python-is-python2
.
It is surprising that software developed by a large company and updated so often still uses Python 2 when in November 2008 the Python foundation announced the end of the 2.x versions of Python and, indeed, its latest patch (2.7.18) goes back to April 4, 2020 (PEP 3.03).
A few days later, when TortoiseHG (thg) was installed on Mint Mate 20.1 according to the instructions on ask ubuntu/Stack Exhange, both Virtual Box and python-is-python2
were eliminated from the system.
The python-is-python3
package was not a prerequisite of thg
, but simply an individual's suggestion to ensure that the script was compiled with Python version 3. I verified that the integration of TortoiseHG in Caja worked after removing the symbolic link /usr/bin/python
to /usr/bin/python3
created by the python-is-python3
package. However, I could no longer launch TortoiseHG Workbench
from the MATE menu and a bash script that launched Workbench
no longer worked. I correctly estimated that it would be easy to fix these problems so I proceeded to remove python-is-python3
and reinstall Virtual Box. Although a new version (i.e. 6.1.22) was available, the python-is-python2
package remained a prerequisite.
I did not want the python
to python2
link, since it is preferable to get rid of this obsolete version of Python. Unfortunately, we cannot simply eliminate the python-is-python2
, as this will result in the elimination of Virtual Box. Fortunately, the latter seems to work fine after removing the symbolic link python -> python2
.
If all of this were to be started over, I would do the following to have TortoiseHG and Virtual Box on a Mint 20.1 system.
- Download the latest version of Virtual Box for Ubuntu 19.10/20.04/20.10/21.04.
- Install Virtual Box. The easiest way is to right-click on the name of the downloaded file in a file browser, the choose
Opent With GDebi Package Installer
option in the context menu and then proceed with the installation. - Eliminate the symbolic link
python
topython2
if it exists :michel@hp:~$ ls -l /usr/bin/python lrwxrwxrwx 1 root root 16 mai 10 00:57 /usr/bin/python -> /usr/bin/python2 michel@hp:~$ sudo rm /usr/bin/python - Create the
python
topython3
symbolic link:michel@hp:~$ sudo ln -s /usr/bin/python3 /usr/bin/python - Install ToroiseHG according to the instructions in the ask ubuntu forum, except that the
python-is-python3
package as indicated in step 5 must not be installed. The symbolic link created in the previous step is sufficient. - After all that, it would be preferable to eliminate the
python
topython3
link in/usr/bin
michel@hp:~$ sudo rm /usr/bin/python
I explained above why there should not be a python
to python2
link, but according to the descriptions of the python-is-python2 and python-is-python3 packages, the file /usr/bin/python
should no longer be present (Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python
at all) hence this last step. By the way, these descriptions end with another important sentence No packages may declare dependencies on this package, or recommend that package. Clearly, Virtual Box violates this directive.
Finally, the file /home/michel/.local/share/applications/toirtoisehg.desktopt
adds TortoiseHG to the Mint 20.1 Mate menu.
As can be seen, the version of Python to use is specified explicitly in the Exec=
line as per the directive. Note that it may be necessary to adjust the path to the TortoiseHG script (in other words to thg
) depending on the directory in which it was built. I also created a bash script to run TortoiseHG from a command line in a terminal.
As before, the version of the Python interpreter used is specified explicitly.