I ran the following command:
madil@madil-XPS-17-9700:~$ sudo apt install nvidia-driver-520 nvidia-dkms-520
And here is a part of the error trace that I got:
Setting up libnvidia-fbc1-525:i386 (525.60.11-0ubuntu0.22.04.1) …
Processing triggers for gnome-menus (3.36.0-1ubuntu3) …
Processing triggers for libc-bin (2.35-0ubuntu3.1) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for mailcap (3.70+nmu1ubuntu1) …
Processing triggers for desktop-file-utils (0.26-1ubuntu3) …
Processing triggers for initramfs-tools (0.140ubuntu13) …
update-initramfs: Generating /boot/initrd.img-5.15.0-56-generic
Errors were encountered while processing:
nvidia-dkms-525
nvidia-dkms-520
nvidia-driver-525
nvidia-driver-520
E: Sub-process /usr/bin/dpkg returned an error code (1)
I get a similar message when I try to install 520 and 515 versions as well.