Cannot install CUDA 11.x on amd64 Ubuntu 18.04: Depends: cuda-11-3 (>= 11.3.1) but it is not going to be installed

Hi - struggling to install CUDA 11.x (really any version >= 11) on amd64 Ubuntu 18.04, though I’ve tried most often with CUDA 11.3. Previously had CUDA 10.2 installed, but purged it via the following (followed by a system reboot):

sudo apt clean 
sudo apt update

sudo apt purge nvidia-*  
sudo apt autoremove

Then, after googling extensively, I tried these commands (link) to install freeglut3-dev, which appears to be a dependency for CUDA that is not called out in the CUDA installation documentation.

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev

Then I attempt to install CUDA 11.3 via the instructions on this link.

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
wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda-repo-ubuntu1804-11-3-local_11.3.1-465.19.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-3-local_11.3.1-465.19.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-3-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

This does not work. I don’t know if the documentation is broken or if it’s a bad build of CUDA, but this is what I get when I follow those instructions:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda
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:
 cuda : Depends: cuda-11-3 (>= 11.3.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If I try to install cuda-11-3, I get this error:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda-11-3
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:
 cuda-11-3 : Depends: cuda-runtime-11-3 (>= 11.3.1) but it is not going to be installed
             Depends: cuda-demo-suite-11-3 (>= 11.3.58) but it is not going to be installed

If I try to install cuda-runtime-11-3, I get this error:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda-runtime-11-3
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:
 cuda-runtime-11-3 : Depends: cuda-drivers (>= 465.19.01) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If I try to install cuda-drivers, I get this error:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda-drivers
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:
 cuda-drivers : Depends: cuda-drivers-465 (= 465.19.01-1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages

If I try to install cuda-drivers-465, I get this error:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda-drivers-465
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:
 cuda-drivers-465 : Depends:   (>= 465.19.01) but it is not going to be installed
                    Depends: libnvidia-decode-465 (>= 465.19.01) but it is not going to be installed
                    Depends: libnvidia-encode-465 (>= 465.19.01) but it is not going to be installed
                    Depends: nvidia-compute-utils-465 (>= 465.19.01) but it is not going to be installed
                    Depends: nvidia-driver-465 (>= 465.19.01) but it is not going to be installed
                    Depends: nvidia-utils-465 (>= 465.19.01) but it is not going to be installed
                    Depends: nvidia-modprobe (>= 465.19.01)
                    Depends: nvidia-settings (>= 465.19.01) but 460.84-0lambda1 is to be installed
E: Unable to correct problems, you have held broken packages.

Installing these dependencies seems to work:

sudo apt-get -y install libnvidia-compute-465 libnvidia-decode-465 libnvidia-encode-465 nvidia-compute-utils-465 nvidia-driver-465 nvidia-utils-465 nvidia-modprobe nvidia-settings

But as soon as I try to work my way back up to installing cuda, I get another cascade of failures:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda-drivers-465
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:
 cuda-drivers-465 : Depends: nvidia-modprobe (>= 465.19.01)
                    Depends: nvidia-settings (>= 465.19.01) but 460.84-0lambda1 is to be installed
E: Unable to correct problems, you have held broken packages.

From this point, it’s just rinse & repeat - no matter what I try, I always end up around this same place. For example, I can run this, and it seems to work:

sudo apt-get -y install nvidia-settings>=465.19.01 nvidia-settings>=465.19.01

But as soon as I try to install cuda-drivers-465 again, it’s back to failing:

ubuntu18user:~/Projects/deepstream$ sudo apt-get -y install cuda-drivers-465
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:
 cuda-drivers-465 : Depends: nvidia-modprobe (>= 465.19.01)
                    Depends: nvidia-settings (>= 465.19.01) but 460.84-0lambda1 is to be installed
E: Unable to correct problems, you have held broken packages.

I’m not sure how to install CUDA 11.x on amd64 Ubuntu 18.04 - this feels like a vicious cycle, and I’m not able to make any significant forward progress at this point. Any ideas?

Please note I was eventually able to successfully install CUDA 11.x using the runfile option:

CUDA Toolkit 11.1.0 Installation Instructions (link)