Issues with NVIDIA Driver on Unbuntu 18.04.4 LTS -- errors

I’m receiving the following errors when trying to install drivers. Note: following suggestions elsewhere on this forum, I did a suggested purge – this is where the output starts – any assistance would be helpful.

My question how do I fix this?

Thanks.

The following packages have unmet dependencies:
 libnvidia-ifr1-415 : Depends: libnvidia-gl-415 but it is not going to be installed
 libnvidia-ifr1-415:i386 : Depends: libnvidia-gl-415:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
em@ub1804usb:~$ sudo apt --fix-broken install libnvidia-gl-415 libnvidia-gl-415:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  lib32gcc1 libc6-i386 libfwup1 libnvidia-common-390 libwayland-client0:i386 libwayland-egl1-mesa libwayland-server0:i386
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  libnvidia-gl-415 libnvidia-gl-415:i386
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/48.7 MB of archives.
After this operation, 218 MB of additional disk space will be used.
(Reading database ... 170780 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-415_415.27-0ubuntu0~gpu18.04.2_i386.deb ...
dpkg-query: no packages found matching libnvidia-gl-410
diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340
dpkg-divert: error: mismatch on package
  when removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 by libnvidia-gl-415'
  found 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-415_415.27-0ubuntu0~gpu18.04.2_i386.deb (--unpack):
 new libnvidia-gl-415:i386 package pre-installation script subprocess returned error exit status 2
Preparing to unpack .../libnvidia-gl-415_415.27-0ubuntu0~gpu18.04.2_amd64.deb ...
dpkg-query: no packages found matching libnvidia-gl-410
diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340
dpkg-divert: error: mismatch on package
  when removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 by libnvidia-gl-415'
  found 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-415_415.27-0ubuntu0~gpu18.04.2_amd64.deb (--unpack):
 new libnvidia-gl-415:amd64 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-gl-415_415.27-0ubuntu0~gpu18.04.2_i386.deb
 /var/cache/apt/archives/libnvidia-gl-415_415.27-0ubuntu0~gpu18.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

This fixed it – from here: https://askubuntu.com/questions/1082837/unmet-dependencies-when-trying-to-remove-libnvidia-ifr1-390

for FILE in $(dpkg-divert --list | grep nvidia-340 | awk '{print $3}'); do sudo dpkg-divert --remove $FILE; done
sudo apt --fix-broken install
sudo apt update ; sudo apt upgrade

Other issues exist but this fixed the issue with driver errors