I had same problem, and solved with purge all unmet dependencies. Here are my steps:
1. Check dependencies related to nvidia
$ dpkg -l | grep nvidia
ii libnvidia-cfg1-440:amd64 440.118.02-0ubuntu1 amd64 NVIDIA binary OpenGL/GLX configuration library
ii libnvidia-common-418 418.165.02-0ubuntu1 all Shared files used by the NVIDIA libraries
ii libnvidia-common-440 440.118.02-0ubuntu1 all Shared files used by the NVIDIA libraries
ii libnvidia-common-455 455.32.00-0ubuntu1
...
2. Try to purge the first package
$ sudo apt purge libnvidia-cfg1-440:amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libnvidia-decode-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
Depends: libnvidia-cfg1-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
Recommends: libnvidia-compute-440:i386 (= 440.118.02-0ubuntu1)
Recommends: libnvidia-decode-440:i386 (= 440.118.02-0ubuntu1)
Recommends: libnvidia-encode-440:i386 (= 440.118.02-0ubuntu1)
Recommends: libnvidia-ifr1-440:i386 (= 440.118.02-0ubuntu1)
Recommends: libnvidia-fbc1-440:i386 (= 440.118.02-0ubuntu1)
Recommends: libnvidia-gl-440:i386 (= 440.118.02-0ubuntu1)
xserver-xorg-video-nvidia-440 : Depends: libnvidia-cfg1-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
(or some similar error message to the above)
3. Add purged package which has unmet dependencies
There is libnvidia-decode-440
in error message, and tried remove that package,
$ sudo apt purge libnvidia-decode-440
...skipped same message
The following packages have unmet dependencies:
cuda-drivers : Depends: libnvidia-decode-440 (>= 440.64.00) but it is not going to be installed
libnvidia-encode-440 : Depends: libnvidia-decode-440 but it is not going to be installed
nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
Depends: libnvidia-decode-440 (= 440.118.02-0ubuntu1) but it is not
...skipped same message
Unmet dependencies in error message is changed libnvidia-encode-440
, So tried both package,
$ sudo apt purge libnvidia-encode-440 libnvidia-decode-440
...
The following packages have unmet dependencies:
cuda-drivers : Depends: libnvidia-decode-440 (>= 440.64.00) but it is not going to be installed
Depends: libnvidia-encode-440 (>= 440.64.00) but it is not going to be installed
nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
Depends: libnvidia-decode-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
Depends: libnvidia-encode-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
...
Seems libnvidia-encode-440
libnvidia-decode-440
is solved. So I keep trying fix all unmet dependencies like this steps.
So, my final command was
$ sudo apt purge -f libnvidia-encode-440 libnvidia-decode-440 cuda-drivers nvidia-driver-440 cuda-runtime-10-1 cuda-10-1 cuda-demo-suite-10-1
and it worked. After removing nvidia and cuda package, I'm re-installing gpu drivers...
Good luck!