Ubantu显卡驱动和库冲突的解决Failed to initialize NVML: Driver/library version mismatch的

1、问题描述

image

Failed to initialize NVML: Driver/library version mismatch
NVML library version: 550.127

2、参考资料

解决Driver/library version mismatch
https://comzyh.com/blog/archives/967/

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver
https://www.gpu-mart.com/blog/nvidia-smi-has-failed-because-it-couldnt-communicate-with-the-nvidia-driver

3、解决

3.1、先卸载原来的驱动

sudo rmmod nvidia_drm
sudo rmmod nvidia_modeset
sudo rmmod nvidia_uvm
sudo rmmod nvidia

可能碰到的问题
image
如果卸载有问题,就先查看nvidia的进程并杀死

sudo lsof -n -w  /dev/nvidia*
sudo kill 进程PID号

image
如果kill了进程都一直无法卸载,就先重启服务器

sudo systemctl reboot

重启完这个时候说明已经卸载干净了
image

3.2、重新安装驱动

参考Ubuntu:解决显卡驱动问题NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver.
https://blog.csdn.net/weixin_39450145/article/details/133643342

查看已安装驱动的版本信息:

ls /usr/src | grep nvidia

image

查看已安装内核:

dpkg --get-selections |grep linux-image

查看正在使用的内核:

uname -a

image

重新安装

sudo apt-get install dkms
sudo dkms install -m nvidia -v 550.54.14
# 这里的550.54.14是自己的显卡驱动版本

但是发现此时还是无法使用nvidia-smi,重启了也是一样
image

继续解决,各种更新

sudo apt update
sudo apt upgrade

也没用

Step 2: Search for Nvidia drivers, run the following command. The output shows a list of available drivers for your GPU.

apt search nvidia-driver

image
安装这个对应的版本,应该是最新的了

sudo apt install nvidia-driver-550

image
还是不行,进行重启

sudo reboot

image

大功告成!!!!

image

posted @ 2024-11-29 19:26  JaxonYe  阅读(12)  评论(0编辑  收藏  举报