Need to upgrade CUDA 12.x from 11.4 but running into issues

I want to run an application that requires cuda 12.x (or 11.8 but I prefer just upgrading to a more recent version). But right now I have cuda 11.4 with Driver Version: 470.223.02. I was going through this guide CUDA Compatibility :: NVIDIA Data Center GPU Driver Documentation
and it turns out that my current system is compatible for a cuda forward compatible upgrade to 12.x.

But when I try to follow the instructions and hence run
sudo apt-get update
sudo apt-get install -y cuda-compat-12-1, I run into the following error:

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package cuda-compat-12-1

I tried running
sudo add-apt-repository -y ppa:graphics-drivers/ppa
but that also didn’t help. Can someone please help me with this issue?

System details:
architecture - x86_64 GNU/Linux

distro info -
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal

see here. You have a couple options:

  1. install from a NVIDIA repository. ppa:graphics.... is not a NVIDIA repository. How to setup a NVIDIA repository? You can find that in the CUDA linux install instructions.

  2. install from the runfile.