在 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 也使用這種架構)。我能做些什麼?

相關內容