NVIDIA driver couldn't find libnvidia-ml.so and can't install cuda successfully

I have following nvidia graphics card in my pc (ubuntu18.04LTS)
Intel i5 9600K
NVIDIA GeForce RTX2070

I have install cuda and nvidia drivers with following way

sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt update
sudo apt install cuda cuda-drivers
sudo reboot

then

nvidia-smi
NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.
Please also try adding directory that contains libnvidia-ml.so to your system PATH.

And I search libnvidia-ml.so

ls /usr/lib/nvidia
pre-install

Any suggestion to get this working? Where does nvidia-smi try to find the libnvidia-ml.so?


Solution 1:

I soloved this problem. remove all cuda and nvidia-drivers

sudo apt-get --purge remove nvidia-*
sudo apt-get --purge remove cuda-*

and then
auto install drivers

sudo ubuntu-drivers autoinstall
sudo reboot

to check drivers are successfully installed

nvidia-smi

then, install cuda-10.0(i'll use tensorflow=1.13.1)

sudo apt install nvidia-driver-418
sudo apt-get install cuda-10.0

install cudnn

echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/nvidia-ml.list
sudo apt update
sudo apt install libcudnn7-dev=7.5.0.56-1+cuda10.0

setting path

sudo cp -a cuda/lib64/* /usr/lib/cuda/lib64/
sudo cp -a cuda/include/* /usr/lib/cuda/include/