Unable to install CUDA toolkit on Zorin OS 17(Ubuntu 22.04)

Since I’m trying to get tensorflow to work with my gpu, I tried to install cuda toolkit 11.8 as per the instructions here התקן את TensorFlow עם pip.

I installed cuda toolkit with the following commands as given here CUDA Toolkit 11.8 Downloads | NVIDIA Developer

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda

However I received this error message

Running hooks in /etc/ca-certificates/update.d…done. done. Processing triggers for dbus (1.12.20-2ubuntu4.1) … Processing triggers for mailcap (3.70+nmu1ubuntu1) … Errors were encountered while processing: nvidia-dkms-520 cuda-drivers-520 cuda-drivers nvidia-driver-520 cuda-runtime-11-8 cuda-11-8 cuda-demo-suite-11-8 cuda

(note that i left of a lot of messages that were simply installing and unpacking before this)

After this point both nvidia smi and Wayland both stopped working.
Upon running nvidia smi, it says that it failed to communicate with the nvidia driver.

After a reinstallation of the nvidia driver 550, nvidia-smi was once again working but wayland was not. I didn’t have the option at the login screen to switch to wayland(this wasn’t the case when I first installed Zorin, only occurred after my failed installation of CUDA 11.8).

Due to this I’ve had to start with a fresh installation of Zorin but I still need to install CUDA 11.8 and CuDNN 8.6.
Could someone help out with this? It’s been rather frustrating.