Installing Nvidia graphics driver in Ubuntu 20.04
I run the following command
sudo apt install nvidia-driver-450
But it throws out an error with the following
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information msudo apt install nvidia-driver-450
sudo rebootay help to resolve the situation:
The following packages have unmet dependencies: nvidia-driver-450 : Depends: libnvidia-gl-450 (= 450.80.02-0ubuntu1) but 450.80.02-0ubuntu0.20.04.2 is to be installed Depends: nvidia-dkms-450 (= 450.80.02-0ubuntu1) Recommends: nvidia-settings but it is not going to be installed Recommends: nvidia-prime (>= 0.8) but it is not installable Recommends: libnvidia-compute-450:i386 (= 450.80.02-0ubuntu1) Recommends: libnvidia-decode-450:i386 (= 450.80.02-0ubuntu1) Recommends: libnvidia-encode-450:i386 (= 450.80.02-0ubuntu1) Recommends: libnvidia-ifr1-450:i386 (= 450.80.02-0ubuntu1) Recommends: libnvidia-fbc1-450:i386 (= 450.80.02-0ubuntu1) Recommends: libnvidia-gl-450:i386 (= 450.80.02-0ubuntu1)
E: Unable to correct problems, you have held broken packages.I also tried installing nvidia-prime but it said there's no installation candidate. I tried everything I found on askubuntu here and still couldn't solve it. Anything I missed out?
12 Answers
Remove all the nvidia packages.
sudo apt update sudo apt-get remove '^nvidia' sudo apt autoremoveIf you have added an Nvidia PPA to
/etc/apt/sources.listremove that PPA by prefacing its line in sources.list with a#to comment it out. Runsudo apt updateto refresh the list of available software.Reboot with
sudo rebootRun the following commands to install the Nvidia 450 driver.
sudo apt install nvidia-driver-450 sudo reboot
After you have installed the nvidia-driver-450 graphics driver in Ubuntu 20.04 it may be updated from nvidia-driver-450 to nvidia-driver-460 by the normal software update activity.
As an alternative to step 4 you can let the ubuntu-drivers program automatically select the proprietary Nvidia packages that are most compatible with your GPU instead of guessing which Nvidia driver packages to install. This method would especially apply in 2022 and later because nvidia-driver-450 is currently a transitional package for nvidia-driver-460 in Ubuntu 20.04. To install the Nvidia proprietary driver this way run the following command instead of the commands in step 4.
sudo ubuntu-drivers autoinstall && sudo rebootThese steps are still working for nvidia-driver-470.
1I had a similar problem;
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies: nvidia-driver-450 : Depends: libnvidia-compute-450 (= 450.80.02-0ubuntu0.20.04.2) but 450.80.02-0ubuntu1 is to be installed Depends: libnvidia-decode-450 (= 450.80.02-0ubuntu0.20.04.2) but it is not going to be installed Depends: libnvidia-encode-450 (= 450.80.02-0ubuntu0.20.04.2) but it is not going to be installed Recommends: nvidia-settings but it is not going to be installed Recommends: nvidia-prime (>= 0.8) but it is not going to be installed Recommends: libnvidia-compute-450:i386 (= 450.80.02-0ubuntu0.20.04.2) Recommends: libnvidia-decode-450:i386 (= 450.80.02-0ubuntu0.20.04.2) Recommends: libnvidia-encode-450:i386 (= 450.80.02-0ubuntu0.20.04.2) Recommends: libnvidia-ifr1-450:i386 (= 450.80.02-0ubuntu0.20.04.2) Recommends: libnvidia-fbc1-450:i386 (= 450.80.02-0ubuntu0.20.04.2)
E: Unable to correct problems, you have held broken packages.I had already removed and purged all nvidia* packages via the following commands;
sudo apt-get remove nvidia*
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autocleanI resolved the issue by the following;
sudo apt-get remove libnvidia*
sudo apt-get purge libnvidia*