Can't upgrade/update ubuntu 18.04 as apt/dpkg error is showing up

Solution 1:

Usually deb-packaged and binary-versions are in conflict. So you should remove hplip-related deb-packages before you install binary-version.

The problem is HPLIP installer. It incorrectly uninstalls Ubuntu-packaged version by deleting files, which are maintained by package manager.

They have note about this problem on support page:

Warning: If you are upgrading HPLIP and HPLIP is already preinstalled with your distribution, or you if you installed HPLIP using an RPM, DEB, or other package, please uninstall the previous version using the method specific for your distribution. If you do not do this, you may have package conflict issues or functionality problems.

It would be safer to reinstall binary HPLIP again by following the guide in my other answer.