How to solve apt "package cannot be configured because package is in a different version" errors?

Solution 1:

sudo dpkg -r --force-all <package-name>

sudo apt-get install <package-name>

Solution 2:

Usually, I remove the offending package first, and try to reinstall the packages afterwards. More than likely, you have some other repos enabled that provides the same packages and that leads to a conflict.

If this doesn't work, and you're SURE that this is coming from the base repositories you can force it (--force-yes). However, this should only be done if you're sure that the package you need won't compromise the integrity of your system.