Nvidia-smi command returns "No devices were found"

I have Debian 12 installed in my server, with 2 NVIDIA L40S, after installing the driver using :
sudo apt-get install nvidia-driver
the command nvidia-smi return No Devices were found

Bug Details:
nvidia-bug-report.log.gz (250.0 KB)

Hi @nileshsengupta43, welcome to the NVIDIA developer forums.

You have conflicting installations (v565 and v535) on your system and also tried updating while X was running.

You appear to be running an X server.  Installing the NVIDIA driver while X is running is not recommended, as doing so may prevent the installer from detecting some potential installation problems, and it may not be possible to start new graphics applications after a new driver is installed.

and nouveau is present in your system.

I recommend to completely purging all NVIDIA drivers from console only access and then find the correct driver for your system from the Driver download pages. Make sure to also read the README fro the download page since that also covers a lot of common issues.

Thanks!