The command which helped me was this:
apt --fix-broken purge
My problem was some of the Nvidia where hold back in the older version for some reason while the others were updated and because of the compatibility issues everything must have been in the latest version. This was my error message (notice the package versions):
The following packages have unmet dependencies:
cuda-drivers : Depends: cuda-drivers-550 (= 550.54.14-1) but it is not installed
libnvidia-decode-545 : Depends: libnvidia-compute-545 (= 545.23.08-0ubuntu1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When using apt --fix-broken purge
, apt removed all old packages (545) and forced the new packages (550) to be installed and thus everything worked just fine. However, in some cases (like mine), apt couldn't manually remove the purgable packages because it tries to install the new packages on top of the old packages instead of removing all old packages and installing new ones. To fix this, I simply used this command with the packages given by the apt (they are marked with a * next to them). For example, I used this:
dpkg --purge libnvidia-decode-545 libnvidia-encode-545 libnvidia-extra-545 libnvidia-fbc1-545 libnvidia-fbc1-545:i386 nvidia-dkms-545 nvidia-kernel-common-545 nvidia-kernel-source-545 libnvidia-cfg1-545 xserver-xorg-video-nvidia-545
After this, I ran apt --fix-broken purge
again and everything worked fine.