在 Debian (11) 上安装 CUDA 工具包 (11.5)

在 Debian (11) 上安装 CUDA 工具包 (11.5)

在 Debian (11) 上安装 CUDA Toolkit (11.5) 的说明在这里组织得很好:developer.nvidia.com/cuda-downloads

但我似乎遇到了一个小的依赖问题,无论我尝试 deb (本地)方法还是 deb (网络)方法。我的印象是apt想要安装470nvidia相关软件包的版本,而应该安装495版本。

如果我运行sudo apt install cuda然后我得到:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 cuda-drivers-495 : Depends: nvidia-driver (>= 495.29.05) but it is not going to be installed
                    Depends: libcuda1 (>= 495.29.05) but it is not going to be installed
                    Depends: libnvcuvid1 (>= 495.29.05) but it is not going to be installed
                    Depends: libnvidia-allocator1 (>= 495.29.05) but 470.74-1 is to be installed
                    Depends: libnvidia-compiler (>= 495.29.05) but 470.74-1 is to be installed
                    Depends: libnvidia-encode1 (>= 495.29.05) but it is not going to be installed
                    Depends: libnvidia-fbc1 (>= 495.29.05) but it is not going to be installed
                    Depends: libnvidia-opticalflow1 (>= 495.29.05) but it is not going to be installed
                    Depends: libnvidia-ptxjitcompiler1 (>= 495.29.05) but 470.74-1 is to be installed
                    Depends: libnvoptix1 (>= 495.29.05) but it is not going to be installed
                    Depends: libxnvctrl-dev (>= 495.29.05) but it is not going to be installed
                    Depends: nvidia-cuda-mps (>= 495.29.05) but 470.74-1 is to be installed
                    Depends: nvidia-detect (>= 495.29.05) but 470.74-1 is to be installed
                    Depends: nvidia-libopencl1 (>= 495.29.05) but 470.74-1 is to be installed
                    Depends: nvidia-opencl-common (>= 495.29.05)
                    Depends: nvidia-opencl-icd (>= 495.29.05) but it is not going to be installed
                    Depends: nvidia-smi (>= 495.29.05) but it is not going to be installed
                    Depends: nvidia-xconfig (>= 495.29.05) but 470.57.02-1 is to be installed
                    Depends: nvidia-modprobe (>= 495.29.05)
 libcufile-11-5 : Depends: liburcu6 but it is not installable
 nvidia-libopencl1 : Conflicts: libopencl1
                     Conflicts: libopencl1:i386
                     Recommends: nvidia-opencl-icd but it is not going to be installed or
                                 opencl-icd
 ocl-icd-libopencl1 : Conflicts: libopencl1
 ocl-icd-libopencl1:i386 : Conflicts: libopencl1
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

我设法通过手动指定版本来安装一些依赖项,例如,sudo apt install nvidia-settings=495.29.05-1但这似乎是一个无休止的过程。

注意:如果我运行sudo apt-cache policy nvidia-driver然后我得到:

nvidia-driver:
  Installed: (none)
  Candidate: 470.74-1
  Version table:
     495.29.05-1 500
        500 https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64  Packages
        500 file:/var/cuda-repo-debian11-11-5-local  Packages
     470.74-1 990
        990 http://deb.debian.org/debian testing/non-free amd64 Packages

有谁知道我应该如何进行?

目前我的 /etc/apt/sources.list 如下:

deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/ /
# deb-src https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/ /
deb http://deb.debian.org/debian/ bookworm contrib
deb http://deb.debian.org/debian/ testing main contrib non-free

PS:我还尝试了“runfile(本地)”方法,但在运行sudo sh cuda_11.5.0_495.29.05_linux.run并选择要安装的组件后,我得到“安装失败”,没有更多详细信息。

答案1

我在 Debian 12(测试)上遇到了这个问题。我通过下载 liburcu6 的 .deb 来修复它 https://packages.debian.org/bullseye/liburcu6 并安装它

sudo apt install ./Downloads/liburcu6_0.12.2-1_amd64.deb

之后,重新运行sudo apt-get -y install cuda效果良好。没有更深入地了解为什么较新的 Debian 版本不包含 liburcu6。

答案2

xserver在运行安装之前退出,以免nvidia-driver安装失败。

sudo service lightdm stop

会做的。

答案3

我有同样的问题,但最近发布了 510.39.01 和 cuda 11-6;

/var/cuda-repo-debian11-11-6-local# dpkg -i nvidia-libopencl1_510.39.01-1_amd64.deb 
Selecting previously unselected package nvidia-libopencl1:amd64.
dpkg: regarding nvidia-libopencl1_510.39.01-1_amd64.deb containing nvidia-libopencl1:amd64:
 nvidia-libopencl1 conflicts with libopencl1
  ocl-icd-libopencl1:amd64 provides libopencl1 and is present and installed.

dpkg: error processing archive nvidia-libopencl1_510.39.01-1_amd64.deb (--install):
 conflicting packages - not installing nvidia-libopencl1:amd64
Errors were encountered while processing:
 nvidia-libopencl1_510.39.01-1_amd64.deb
# dpkg -l | grep liburcu6
ii  liburcu6:amd64                         0.12.2-1                           amd64        userspace RCU (read-copy-update) library

当然,如果我尝试删除ocl-icd-libopencl1,我会有大约 50 个依赖于它的包。我认为 Vincent 已经解决了这个 bug debian #755513,但这可能是一个新问题。

答案4

我通过下载 liburcu6 的 .deb 来修复它https://packages.debian.org/bullseye/liburcu6并安装它

sudo apt install ./Downloads/liburcu6_0.12.2-1_amd64.deb

我访问了提到的页面,但只列出了以下架构:

Architecture    Package Size    Installed Size    Files
amd64           69.7 kB         366.0 kB          [list of files]
arm64           67.9 kB         342.0 kB          [list of files]
armel           62.7 kB         316.0 kB          [list of files]
armhf           63.1 kB         248.0 kB          [list of files]
i386            69.8 kB         348.0 kB          [list of files]
mips64el        62.0 kB         341.0 kB          [list of files]
mipsel          62.2 kB         326.0 kB          [list of files]
ppc64el         72.0 kB         610.0 kB          [list of files]
s390x           67.2 kB         342.0 kB          [list of files]

我需要一个用于 amd64 的(Intel CPU 也使用这种架构)。我能做些什么?

相关内容