您现在的位置是:首页 >技术杂谈 >nvidia-smi:Failed to initialize NVML:Driver/library version mismatch网站首页技术杂谈
nvidia-smi:Failed to initialize NVML:Driver/library version mismatch
初步看应该是nvidia驱动和系统内核版本不一致,通过下面命令查看具体版本信息
dmesg|grep NVRM
API mismatch: the client has the version 515.86.01, NVRM: this kernel module has the version 470.182.03.
即驱动目前的版本515.86.01,系统内核版本470.182.03不匹配,这里为保证不影响之前环境,我选择降低驱动版本,具体操作如下:
1.驱动卸载
sudo apt-get --purge remove nvidia*
sudo apt autoremove
执行完之后可以通过nvcc -V或者nvidia-smi来查看是否卸载成功
2.下载对应驱动
Unix Drivers | NVIDIA
我这里下载的是
https://us.download.nvidia.com/XFree86/Linux-x86_64/470.182.03/NVIDIA-Linux-x86_64-470.182.03.run
3. 正常执行如下命令即可成功安装
sudo ./*.run
4. 执行nvcc -V 或者 nvidia-smi验证是否安装成功
5.ps
我执行第3步的时候出现这个错误
Unable to find the kernel source tree for the currently running kernel.
ERROR:Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured on Red Hat Linux system, for exzmple ,be sure you have the 'kernel-source' or 'kernel-devel' RPM installed .If you know the correct kernel source files are installed ,you may specify the kernel source path with the '--kernel-source-path' command line option.
具体解决方式如下:
1) 使用命令,查看你使用的是:
uname -r
我的是4.15
2)从Ubuntu官方内核库中下载Linux Kernel 4.15
64 位 Ubuntu 系统:
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb
3) 下载完成后使用如下命令安装Linux Kernel 4.15:
sudo dpkg -i *.deb
4) 使用如下命令更新Grub引导加载程序
sudo update-grub
如果使用BURG引导加载程序,请运行:
sudo update-burg
5)重新启动系统
sudo reboot
参考链接: