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文件,只需选择工具包。

这些步骤解决了我的问题。希望它能帮助其他人。

相关内容