在Ubuntu 18.04中, 安装CUDA 10.1和nvidia驱动程序时出现问题

分享于 

4分钟阅读

ubuntu

  繁體

问题:

已安装nvidia-440驱动程序。


$ sudo apt install nvidia-driver-440



然后执行以下命令:


sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub


sudo bash -c 'echo"deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'


sudo bash -c 'echo"deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda_learn.list'


sudo apt update



sudo apt install cuda-10-1

错误:


 The following packages have unmet dependencies:


 cuda-drivers-450 : Depends: libnvidia-compute-450 (>= 450.36.06) but it is not installable


 libnvidia-decode-450 : Depends: libnvidia-compute-450 (= 450.36.06-0ubuntu1) but it is not installable


 nvidia-compute-utils-450 : Depends: libnvidia-compute-450 but it is not installable


 nvidia-driver-450 : Depends: libnvidia-compute-450 (= 450.36.06-0ubuntu1) but it is not installable


 Recommends: libnvidia-compute-450:i386 (= 450.36.06-0ubuntu1) but it is not installable


 Recommends: libnvidia-decode-450:i386 (= 450.36.06-0ubuntu1) but it is not installable


 Recommends: libnvidia-encode-450:i386 (= 450.36.06-0ubuntu1) but it is not installable


 Recommends: libnvidia-ifr1-450:i386 (= 450.36.06-0ubuntu1) but it is not installable


 Recommends: libnvidia-fbc1-450:i386 (= 450.36.06-0ubuntu1) but it is not installable


 Recommends: libnvidia-gl-450:i386 (= 450.36.06-0ubuntu1) but it is not installable


 nvidia-utils-450 : Depends: libnvidia-compute-450 but it is not installable


E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).



即使使用以下故障排除命令,问题仍然存在。


sudo dpkg --configure -a


sudo apt-get install -f


sudo apt remove --autoremove nvidia-cuda-toolkit


sudo apt-get clean


sudo apt-get autoremove




答案1:

从runfile安装CUDA比安装NVIDIA驱动程序更简单,更流畅。它只涉及将文件复制到系统目录,与系统内核或联机编译无关,因此,我个人不建议添加NVIDIA的存储库,通过apt-get或其他程序包管理器安装CUDA,因为这没有降低安装或卸载的复杂性,但会增加混淆存储库配置的风险。

CUDA runfile安装程序可以从NVIDIA 网站下载,你下载的是一个软件包,有以下三个组件:

  • NVIDIA驱动程序安装程序,但通常是稳定版本;
  • CUDA安装程序;
  • CUDA示例;

安装CUDA Toolkit的脚本如下。


cd ~


wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run


chmod +x cuda_7.5.18_linux.run


./cuda_7.5.18_linux.run --extract=$HOME


sudo ./cuda-linux64-rel-7.5.18-19867135.run



安装完成后,配置运行时库。


sudo bash -c"echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"


sudo ldconfig



还建议Ubuntu用户将字符串/usr/local/cuda/bin追加到系统文件/etc/environments,以便nvcc包含在$PATH中,这将在重新启动后生效。



相关文章