Unable to install nvidia drivers on Ubuntu 18.04 [duplicate]

Solution 1:

Some of the packages have unmet dependencies, likely because the PPA, but it's unclear. My advice is first remove the PPA by using:

sudo apt-add-repository -r ppa:graphics-drivers/ppa

(Note the -r means remove)

Next you want to make sure your package listing is up-to-date:

sudo apt update

Next you should likely remove all the nvidia packages you might have installed:

sudo apt remove nvidia*
sudo apt autoremove

Now with a fresh slate try to invoke the driver auto installer:

sudo ubuntu-drivers autoinstall

If you still get problems with held packages, it could be because you updated some packages while the PPA was enabled, in which case I would suggest running:

sudo apt install aptitude
sudo aptitude install <name_of_package_with_conflicts>

This will invoke an interactive series of questions basically showing you all the ways the package could be installed if you were to remove another package or downgrade one, etc. Step through them until you find the option that fits your needs (you don't have to accept the first option given)

Solution 2:

You have broken dependencies. Try fixing them with

$ sudo apt -f install