实验小白,准备跑一下代码,按照要求安装好环境,测试demo时提示:
RuntimeError: The NVIDIA driver on your system is too old (found version 9000)
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda-10.1'
RuntimeError: The NVIDIA driver on your system is too old (found version 9000).Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx
Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version
of the CUDA driver.
原因:
NVIDIA驱动版本太老了,与cuda版本不匹配
查看NVIDIA版本
nvidia-smi
我的显示
NVIDIA-SMI 384.130 Driver Version: 384.130
我的cuda版本CUDA Version 10.1.243
根据官方的CUDA要求的linux下的Driver Version
cuda10.1 要求 Driver Version>=418.39
解决办法:
更新NVIDIA驱动
准备工作
1.查看显卡信息
lspci | grep -i nvidia
显示GeForce GTX 1050 Ti
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
2.到官网下载对应版本的驱动
点击search 选择其中一个满足要求的版本即可
3.禁用nouveau驱动
因为我之前已经安装了384版的NVIDIA驱动,所以nouveau驱动已经禁用了,可用一下命令查看是否禁用,无输出表示已禁用
lsmod | grep nouveau
4.卸载已有驱动
打开终端,输入
sudo apt-get purge nvidia*
安装一些 NVIDIA 显卡依赖的软件,在终端依次执行如下命令
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install build-essential libc6:i386
5.安装新驱动
在终端输入以下命令,关闭图形界面服务
sudo service lightdm stop
然后按住 Ctrl+alt+f1进入命令行界面。输入用户名和密码,登录系统。
给驱动run文件赋予执行权限
sudo chmod a+x NVIDIA-Linux-x86_64-460.73.01.run
NVIDIA-Linux-x86_64-460.73.01.run 是我下载的驱动版本,按需修改。下载的安装包默认应该在/home/XXX/downloads 文件下cd /home/XXX/downloads
然后执行
因为我们已经关闭了X服务,禁用nouveau,执行以下即可
sudo ./NVIDIA-Linux-x86_64-460.73.01.run -no-opengl-files
6.安装过程中的选项:
不太记得了 ,以下选项选择来自博客https://blog.csdn.net/wangyjfrecky/article/details/84029668
The distribution-provided pre-install script failed! Are you sure you want to continue? 选择 yes 继续。
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? 选择 No 继续。
问题没记住,选项是:install without signing
问题大概是:Nvidia’s 32-bit compatibility libraries? 选择 No 继续。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 选择 Yes 继续
7.检验是否成功
在终端输入以下命令,查看版本信息
nvidia-smi
恢复图形界面,输入以下命令,然后Ctrl+alt+f7
sudo service lightdm start
之后测试demo,此问题消失