我一直尝试安装nvidia-cuda-toolkit
但sudo apt install nvidia-cuda-toolkit
显示以下错误:
The following packages have unmet dependencies: nvidia-cuda-toolkit :
Depends: nvidia-cuda-dev (= 10.1.243-3) but it is not going to be
installed E: Unable to correct problems, you have held broken
packages.
Running `sudo apt install nvidia-cuda-dev` yields:
The following packages have unmet dependencies: nvidia-cuda-dev :
Depends: libcublas10 (= 10.1.243-3) but 10.2.2.214-1 is to be
installed
Recommends: libvdpau-dev but it is not going to be installed
Recommends: libnvcuvid1 but it is not installable E: Unable to correct problems, you have held broken packages.
我尝试从 NVIDIA 官方网站安装它,但是没有任何效果。
更新:输出sudo apt-cache show nvidia-cuda-dev
:
Package: nvidia-cuda-dev Architecture: amd64 Version: 10.1.243-3
Priority: extra Section: multiverse/libdevel Source:
nvidia-cuda-toolkit Origin: Ubuntu Maintainer: Ubuntu Developers
<[email protected]> Original-Maintainer: Debian
NVIDIA Maintainers <[email protected]> Bugs:
https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 1100028
Depends: libcudart10.1 (= 10.1.243-3), libaccinj64-10.1 (=
10.1.243-3), libcuinj64-10.1 (= 10.1.243-3), libnvrtc10.1 (= 10.1.243-3), libnvtoolsext1 (= 10.1.243-3), libnvvm3 (= 10.1.243-3), libcublas10 (= 10.1.243-3), libcublaslt10 (= 10.1.243-3), libnvblas10
(= 10.1.243-3), libcufft10 (= 10.1.243-3), libcufftw10 (= 10.1.243-3),
libcurand10 (= 10.1.243-3), libcusolver10 (= 10.1.243-3),
libcusolvermg10 (= 10.1.243-3), libcusparse10 (= 10.1.243-3),
libnppc10 (= 10.1.243-3), libnppial10 (= 10.1.243-3), libnppicc10 (=
10.1.243-3), libnppicom10 (= 10.1.243-3), libnppidei10 (= 10.1.243-3), libnppif10 (= 10.1.243-3), libnppig10 (= 10.1.243-3), libnppim10 (=
10.1.243-3), libnppist10 (= 10.1.243-3), libnppisu10 (= 10.1.243-3), libnppitc10 (= 10.1.243-3), libnpps10 (= 10.1.243-3), libnvgraph10 (=
10.1.243-3), libnvjpeg10 (= 10.1.243-3), libcupti-dev (= 10.1.243-3), libnvidia-ml-dev (= 10.1.243-3), libthrust-dev Recommends: libcuda1
(>= 418.39) | libnvidia-tesla-cuda1 (>= 418.39) | libcuda.so.1 (>=
418.39) | libcuda-10.1-1, libgl1-mesa-dev | libgl-dev, libvdpau-dev, libnvcuvid1 Breaks: libcuda1 (<< 418.39) Filename:
pool/multiverse/n/nvidia-cuda-toolkit/nvidia-cuda-dev_10.1.243-3_amd64.deb
Size: 420308420 MD5sum: fbad3f84b31fe19a382ade63a57bc3ff SHA1:
ceb1f2e2bfdc6fafbeced70bbc707d3e9f83e6f5 SHA256:
85b188b198c53be4d24a9d706dce2252d1d4d69592691c90d4bfd0cabc04f720
Homepage: https://developer.nvidia.com/cuda-zone Description-en:
NVIDIA CUDA development files The Compute Unified Device Architecture
(CUDA) enables NVIDIA graphics processing units (GPUs) to be used for
massively parallel general purpose computation. . This package
contains the development files: headers and libraries.
Description-md5: 23a17262479fe7daf1cae67727e949c7
我也尝试过这篇 Medium 文章。
答案1
我认为您可能添加了 PPA 或更改了“/etc/apt/sources.list”中的 sources.list。如果是这样,请先尝试将您的 sources.list 恢复到其原始状态(对于 ubuntu focal),应该是这样的:
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
你的可能不完全相同,但只要确保所有镜像都属于 焦点。
然后使用以下命令列出您的软件包源:
sudo apt-cache policy
现在,如果您发现任何与 nvidia/cuda 相关的 PPA,请尝试使用以下命令将其删除:
sudo add-apt-repository --remove ppa:<ppa_name>/ppa
然后尝试清除所有与 nvidia 或 cuda 相关的软件包
sudo apt-get --purge remove "*cublas*" "cuda*" "*nvidia*"
并确保 /usr/local/cuda 中没有 cuda 文件。如果有,请将其删除。最后,使用以下命令清理缓存并删除不需要的包:
sudo apt-get clean
sudo apt-get autoremove
现在再试一次以下操作,希望它能够起作用:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nvidia-cuda-toolkit
答案2
我遇到了这个问题,无法从 nvidia-450 升级到 nvidia-455。删除旧驱动程序并重新安装即可解决问题:
sudo apt-get purge 'nvidia-.*'
sudo ubuntu-drivers autoinstall
答案3
对我来说,用一个“apt purge”命令删除所有有依赖问题的软件包是可行的。
sudo apt purge nvidia-cuda-toolkit nvidia-cuda-dev