Question

Your python3 install is corrupted. Please fix the '/usr/bin/python3' symlink.

When trying to do “do-release-upgrade” from current Ubuntu 18.04 to new 19.04 I am getting error

"Your python3 install is corrupted. Please fix the ‘/usr/bin/python3’ symlink "

I currently have python 2.7, 3, 3.6 and 3.7 installed.

Please advise what shall i try. Thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

i had the same problem with my python3 installation because i installed an alternative version. the default that came with ubuntu 18.04 was python3.6 and i had installed 3.7 & 3.8 and when ever i wanted to switch to the specific version i would use use update-alternative command. the issue with process is that it alters the default python3 simlink to point to the alternative installation path from

/usr/bin/python3.6

to

/etc/alternatives/python3

and the system expects that the first not the second even the terminal wouldn’t work so to restore to the default,

  • remove alternative python installation (optional) but pointless to keep one when ubuntu 20.04 uses later version of python3
sudo update-alternative --remove python3 {/path/to/python3.7}
  • restore the old (defulat) symlink of python3
sudo rm -rf /usr/bin/python3 && sudo ln -s /usr/bin/python3.6 /usr/bin/python3

and after that if you check your python3 symlink path

ls -la /usr/bin/python3.6

and it should point to the old (default) /usr/bin/python3.6

good luck and hope this helps.

Any update? I have manually install python2.7 and python3.7 after deleting the executable accidentally.

linux@linux:/usr/bin$ 
==> which python
/usr/bin/python
linux@linux:/usr/bin$ 
==> l python
lrwxrwxrwx 1 root root 24 May 22 00:47 python -> /usr/local/bin/python2.7
linux@linux:/usr/bin$ 
==> l python*
lrwxrwxrwx 1 root root 24 May 22 00:47 python -> /usr/local/bin/python2.7
lrwxrwxrwx 1 root root 22 May 22 00:47 python3 -> /usr/local/bin/python3
linux@linux:/usr/bin$ 
==> python --version
Python 3.7.4
linux@linux:/usr/bin$ 
==> lsb_release -a
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
linux@linux:/usr/bin$ 
==> sudo do-release-upgrade
Traceback (most recent call last):
  File "/usr/bin/do-release-upgrade", line 8, in <module>
    from DistUpgrade.DistUpgradeVersion import VERSION
ModuleNotFoundError: No module named 'DistUpgrade'

Seems i have done something to python. Now when i try sudo apt upgrade ,

i get

Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)```

Hello,

I believe this is a know issue, you can also check this in the following report in the launchpad bugs forum:

https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1825655

The suggested workaround is to remove the python’s binary in /usr/bin and then to create a symlink and perform the upgrade:

sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python

and then perform the upgrade

do-release-upgrade

I would also recommend you to backup your droplet in case something goes wrong, however you will simply remove the binary file from the /usr/bin and then create a symlink to replace it.

Let me know how it goes.

Alex