30

After following all the instructions in CUDA Toolkit 11.1 Downloads, the last instruction

sudo apt-get -y install cuda

doesn't work for me.

Terminal shows this message:

The following packages have unmet dependencies:
 cuda : Depends: cuda-11-1 (>= 11.1.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

PS: I have an NVIDIA GTX 1660TI card in my computer.

Any solution please?

Taha Sherif
  • 431
  • 1
  • 5
  • 6

8 Answers8

29

I just ran into this issue and solved it by running the following terminal commands:

sudo apt clean
sudo apt update
sudo apt purge 'nvidia-*' 
sudo apt autoremove
sudo apt install -y cuda

Major thanks to this post on the Nvidia forums.

13

I think the issue is the CUDA driver version. It looks like the installer tries to install the newest version 455.23.05 and the installation actually fails there.

I've solved it by first downloading the local installer and unselecting the CUDA driver installation, so it just installs the toolkit.

wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
chmod +x cuda_11.1.0_455.23.05_linux.run 
sudo ./cuda_11.1.0_455.23.05_linux.run 

In the menu unselect the driver installation: enter image description here If not already done, add the nvidia repo as per instructions from the official website before installing the driver:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update

Install the CUDA driver 450 manually:

sudo apt-get install cuda-drivers-450

Test by running nvcc -V In case nvcc is not found, don't forget to add it to your PATH: PATH=$PATH:/usr/local/cuda/bin

3

You have to uninstall any nvidia driver before running sudo apt install -y cuda
To do so, got to "Software & Updates" -> "Additional drivers" -> Using X.Org X (nouveou)

d.lime
  • 160
0

What helped me in resolving this issue is that I installed up to dated version of the nvidia driver with command "sudo apt install nvidia-driver-NNN" and then pointed on it to be used from the Software & Updates - Additional Drivers

0

For the unmet dependencies, try the following in terminal:

apt --fix-broken install
guttermonk
  • 1,024
0

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.

Hirbod Behnam
  • 101
  • 1
  • 4
0
sudo apt update
sudo apt --fix-broken install
sudo apt-mark showhold
apt-cache depends cudnn9-cuda-11
sudo apt install cudnn9-cuda-11-8

The above commands solved the problem

TommyPeanuts
  • 1,147
Jeeva
  • 1
-1

As in the previous post, I run this for Ubuntu 20.04 Nvidia Quadro P520:

sudo apt clean 
sudo apt update

sudo apt purge nvidia-*
sudo apt autoremove

Reboot your PC and run this:

sudo apt install -y cuda