Cuda 10.1 on Ubuntu 18.04.5 LTS

Hello,
I need to use Tensorflow-gpu 2.3.0, for this reason I need Cuda 10.1.
Then I used this method:

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
sudo apt-get -y install cuda-10-1    # and not cuda to avoid installing version 11

Unfortunately I have:

$ sudo apt install cuda-10-1
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-10-1 : Depends: cuda-toolkit-10-1 (>= 10.1.243) but it is not going to be installed
             Depends: cuda-runtime-10-1 (>= 10.1.243) but it is not going to be installed
             Depends: cuda-demo-suite-10-1 (>= 10.1.243) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If I try apt install cuda-toolkit-10-1, I get other similar errors.

Any idea?
Thanks!

What has worked for me in the past is to append all the packages that appear in the “but it is not going to be installed” list, and repeat the process until this finally works.

In your case

sudo apt install cuda-10-1 cuda-toolkit-10-1 cuda-runtime-10-1 cuda-demo-suite-10-1

Rinse, repeat until this goes through or indicates a dependency that may be in conflict with an installed package.

Christian