I observed this error message on Windows 10 1903 running WSL Ubuntu when I wanted to upgrade from 16.04 LTS to 18.04 LTS.
do-release-upgrade had failed, I switched
python alternatives to every choice offered by
update-alternatives --config python and ran the upgrade command again. That did not help.
Then I checked the log file
/var/log/dist-upgrade/main.log which contained the lines
2019-09-02 20:58:08,686 DEBUG _pythonSymlinkCheck run
2019-09-02 20:58:08,687 DEBUG python symlink points to: '/etc/alternatives/python', but expected is 'python2.7' or
2019-09-02 20:58:08,688 ERROR pythonSymlinkCheck() failed, aborting
So although the error message mentions python3, the issue is about python2.
The upgrade script checks for
/usr/bin/python linking to
/usr/bin/python2, see the source code of
DistUpgrade/DistUpgradeController.py here: ubuntu launchpad
So one solution is to completely remove python from the alternative system and add the link manually, as described in the most popular answer.
If you don't want to remove python from the alternative system, just change the link only for the time during the upgrade process:
# rm /usr/bin/python
# ln -sf /usr/bin/python2.7 /usr/bin/python
This worked for me.
During the upgrade process, the link is automatically repaired. So when the upgrade is finished, it points to the python entry in the alternatives directory:
$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 24 Sep 2 22:01 /usr/bin/python -> /etc/alternatives/python
Edit: for thorough information, the issue might also appear if you upgrade from 18.04 LTS to 19.04 and the anwser applies to this situation, too.