NVIDIA SMI instruction reports an error: failed to initialize nvml: Driver solution
1. Check the kernel version
cat /proc/driver/nvidia/version
2. View the driver version
dpkg -l | grep nvidia
3. Inconsistent. Uninstall the driver and install the driver of the same version as the kernel
sudo apt-get --purge remove nvidia*
sudo apt autoremove
sudo apt-get remove --purge nvidia-\*
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt-cache search nvidia
Check the recommend version and install it.
ubuntu-drivers devices
sudo apt-get install nvidia-415 nvidia-settings nvidia-prime