CUDA 安裝問題 22.04 lts

CUDA 安裝問題 22.04 lts

我剛剛更新到 ubuntu 22.04,並且正在嘗試更新我的 cuda 安裝。然而,我可能弄亂了我的包裹。 “無法糾正問題,你拿著破損的包裹。”我在嘗試清除舊安裝時可能做錯了什麼。

我正在嘗試透過安裝 cuda 和 cuda 工具包https://developer.nvidia.com/,並在最後一步停止。嘗試直接從 apt 安裝會出現相同的錯誤(請參閱下文)。

請幫忙。我不確定我做錯了什麼。

(base) xxx@xxx:~$ 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-515 : Depends: nvidia-modprobe (>= 515.65.01) but 470.103.01-1 is to be installed
                    Depends: nvidia-settings (>= 515.65.01) but 510.47.03-0ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

(base) xxx@xxx:~$ apt-cache policy nvidia-modprobe
nvidia-modprobe:
  Installed: 470.103.01-1
  Candidate: 470.103.01-1
  Version table:
     515.65.01-0ubuntu1 450
        450 file:/var/cuda-repo-ubuntu2204-11-7-local  Packages
 *** 470.103.01-1 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages
        100 /var/lib/dpkg/status

(base) xxx@xxx:~$ apt-cache policy nvidia-settings
nvidia-settings:
  Installed: 510.47.03-0ubuntu1
  Candidate: 510.47.03-0ubuntu1
  Version table:
     515.65.01-0ubuntu1 450
        450 file:/var/cuda-repo-ubuntu2204-11-7-local  Packages
 *** 510.47.03-0ubuntu1 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

(base) xxx@xxx:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

我無法直接使用 apt 糾正問題,但以下步驟可以修復我的 cuda 安裝:

  1. 清除所有 nvidia 和 cuda 驅動程式 (sudo apt remove --purge nvidia-* && sudo apt remove --purge cuda*)
  2. 透過 Nvidia 的來源安裝 cuda,使用 RUN 本機文件,而不是 deb 套件。第一次運行成功安裝nvidia驅動,但安裝工具包失敗
  3. 再次運行 RUN 文件,只需選擇工具包即可。

這些步驟解決了我的問題。希望它對其他人有幫助。

相關內容