NVRM: API mismatch

I am installing cuda-10.0 on my ubuntu 18.04 system. I have followed the instructions as per the official website : https://docs.nvidia.com/cuda/cuda-installation-guide-linux/

While running the samples provided with cuda toolkit to verify the installation, I get following error:

/usr/local/cuda-10.0/samples/bin/x86_64/linux/release/deviceQuery Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 35 -> CUDA driver version is insufficient for CUDA runtime version Result = FAIL

I ran the command “nvidia-smi” and got below output:

Failed to initialize NVML: Unknown Error

Below is the output of command “dmesg”

[4424407.320909] NVRM: API mismatch: the client has the version 440.82, but NVRM: this kernel module has the version 440.44. Please NVRM: make sure that this kernel module and all NVIDIA driver NVRM: components have the same version.

[4426448.420756] NVRM: API mismatch: the client has the version 340.108, but NVRM: this kernel module has the version 440.44. Please NVRM: make sure that this kernel module and all NVIDIA driver NVRM: components have the same version.

Output of command “cat /proc/driver/nvidia/version”

NVRM version: NVIDIA UNIX x86_64 Kernel Module 440.44 Sun Dec 8 03:38:56 UTC 2019

GCC version: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

Output of command “apt-cache policy nvidia-driver-440”

nvidia-driver-440:
Installed: 440.82-0ubuntu0~0.18.04.1
Candidate: 440.82-0ubuntu0~0.18.04.1
Version table:
*** 440.82-0ubuntu0~0.18.04.1 500
500 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status
440.64.00-0ubuntu1 500
500 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 Packages
440.59-0ubuntu0.18.04.1 500
500 http://de.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages
440.33.01-0ubuntu1 500
500 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 Packages

Looks like the graphics drivers are of the version 440.82 but cuda installs 440.64 driver version.
But in the dmesg command, it shows the kernel has the version 440.44.
I am confused about all these different versions.

I tried uninstalling all cuda and nvidia versions from my system and then installing them again.
But I still get the same error in the end.

Can anyone please advice me on how can I fix that ?