I am unable to install vim on my machine, unmet dependency libpython3.8

$ sudo apt install vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 vim : Depends: libpython3.8 (>= 3.8.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

How to fix this?


Solution 1:

I encountered the same problem when updating from 18.04 (actually 16.04) to 20.04.

After manually installing the package libpython3.8, which resulted in different errors, I found this thread. Their suggested commands yielded several warnings and resulted in apt suggesting to run apt --fix-broken install which in my case seems to fix everything.