Installed Graphics driver 535 version nvidia, but nvidia-smi gives error

Installed nvidia driver 535 on MSI GF63 Thin, RTX 3050, but when running “nvidia-smi”, it gives error “NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.”
However nvidia-x server is also installed and set on-demand mode. Not sure why this error coming?
btw I installed drivers using ppa repository.

You could try pasting the output of apt list --installed | grep nvidia here.

I have the same issue after installing driver 535 with sudo apt install nvidia-driver-535. the output of the command you mentioned is this: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libnvidia-cfg1-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-common-535/jammy-updates,jammy-updates,jammy-security,jammy-security,now 535.161.07-0ubuntu0.22.04.1 all [installed,automatic]
libnvidia-compute-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-compute-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 i386 [installed,automatic]
libnvidia-decode-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-decode-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 i386 [installed,automatic]
libnvidia-encode-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-encode-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 i386 [installed,automatic]
libnvidia-extra-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-fbc1-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-fbc1-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 i386 [installed,automatic]
libnvidia-gl-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-gl-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 i386 [installed,automatic]
linux-modules-nvidia-535-5.15.0-1052-oracle/jammy-updates,jammy-security,now 5.15.0-1052.58 amd64 [installed,automatic]
linux-modules-nvidia-535-6.5.0-1018-oracle/jammy-updates,jammy-security,now 6.5.0-1018.18~22.04.1+2 amd64 [installed,automatic]
linux-modules-nvidia-535-oracle-edge/jammy-updates,jammy-security,now 6.5.0-1018.18~22.04.1+2 amd64 [installed,automatic]
linux-modules-nvidia-535-oracle-lts-22.04/jammy-updates,jammy-security,now 5.15.0-1052.58 amd64 [installed,automatic]
linux-objects-nvidia-515-5.15.0-43-generic/now 5.15.0-43.46+1 amd64 [installed,local]
linux-objects-nvidia-525-6.5.0-21-generic/jammy-updates,jammy-security,now 6.5.0-21.21~22.04.1+1 amd64 [installed,automatic]
linux-objects-nvidia-535-5.15.0-1052-oracle/jammy-updates,jammy-security,now 5.15.0-1052.58 amd64 [installed,automatic]
linux-objects-nvidia-535-6.5.0-1018-oracle/jammy-updates,jammy-security,now 6.5.0-1018.18~22.04.1+2 amd64 [installed,automatic]
linux-signatures-nvidia-5.15.0-1052-oracle/jammy-updates,jammy-security,now 5.15.0-1052.58 amd64 [installed,automatic]
linux-signatures-nvidia-5.15.0-43-generic/now 5.15.0-43.46+1 amd64 [installed,local]
linux-signatures-nvidia-6.5.0-1018-oracle/jammy-updates,jammy-security,now 6.5.0-1018.18~22.04.1+2 amd64 [installed,automatic]
linux-signatures-nvidia-6.5.0-21-generic/jammy-updates,jammy-security,now 6.5.0-21.21~22.04.1+1 amd64 [installed,automatic]
nvidia-compute-utils-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
nvidia-driver-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed]
nvidia-firmware-535-535.161.07/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
nvidia-kernel-common-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
nvidia-kernel-source-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
nvidia-modprobe/unknown,now 530.30.02-0ubuntu1 amd64 [installed,auto-removable]
nvidia-prime/jammy,jammy,now 0.8.17.1 all [installed]
nvidia-settings/unknown,now 530.30.02-0ubuntu1 amd64 [installed,automatic]
nvidia-utils-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]
xserver-xorg-video-nvidia-535/jammy-updates,jammy-security,now 535.161.07-0ubuntu0.22.04.1 amd64 [installed,automatic]