Ubuntu 18.04 上 CUDA 11.3 安装失败

Ubuntu 18.04 上 CUDA 11.3 安装失败

我已经在配备 nVidia 显卡 GM107GLM [Quadro M2000M] 的 HP 笔记本电脑上安装了 Ubuntu 桌面 18.04:

$ sudo lshw -C display
*-display
description: VGA compatible controller
product: GM107GLM [Quadro M2000M]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:01:00.0
version: a2
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
configuration: driver=nvidia latency=0
resources: irq:133 memory:e4000000-e4ffffff memory:a0000000-afffffff memory:b0000000-b1ffffff ioport:3000(size=128) memory:e5080000-e50fffff
*-display
description: VGA compatible controller
product: HD Graphics 530
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 06
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:131 memory:e3000000-e3ffffff memory:40000000-4fffffff ioport:6000(size=64) memory:c0000-dffff

我已经安装了 nvidia-driver-460:

$ nvidia-smi 
Sat May 22 16:03:23 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.73.01    Driver Version: 460.73.01    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro M2000M       Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   33C    P8    N/A /  N/A |    716MiB /  4043MiB |      5%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2145      G   /usr/lib/xorg/Xorg                551MiB |
|    0   N/A  N/A      2332      G   /usr/bin/gnome-shell               33MiB |
|    0   N/A  N/A      2939      G   ...AAAAAAAA== --shared-files        6MiB |
|    0   N/A  N/A      3456      G   ...AAAAAAAAA= --shared-files       12MiB |
|    0   N/A  N/A      9540      G   ...AAAAAAAAA= --shared-files       49MiB |
|    0   N/A  N/A      9843      G   ...oken=17184766749938794993        8MiB |
|    0   N/A  N/A      9957      G   /opt/zoom/zoom                      5MiB |
|    0   N/A  N/A     10072      G   ...AAAAAAAAA= --shared-files       34MiB |
+-----------------------------------------------------------------------------+

我一直在尝试安装 CUDA Toolkit 11.3,按照链接中的说明进行操作:Ubuntu 18.04 上安装 CUDA 11.3

$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
$ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda-repo-ubuntu1804-11-3-local_11.3.1-465.19.01-1_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1804-11-3-local_11.3.1-465.19.01-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-ubuntu1804-11-3-local/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get -y install cuda

所有命令均成功,最后一条命令失败,如下所示:

$ sudo apt-get -y install cuda
Reading package lists... Done
Building dependency tree       
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 : Depends: cuda-11-3 (>= 11.3.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我该如何解决这个问题?我需要安装一些依赖项吗?或者安装其他版本的 CUDA?

谢谢

答案1

我在 Ubuntu 20.04 上遇到了类似的问题。最后我采取了以下措施:

  • 全部清除cuda*

    sudo rm /etc/apt/sources.list.d/cuda*
    sudo apt remove --autoremove nvidia-cuda-toolkit
    sudo apt-get autoremove
    sudo apt-get autoclean
    
  • 然后我使用了https://developer.nvidia.com/cuda-downloads,连续选择以下选项:

    1. Linux
    2. x86_64
    3. Ubuntu
    4. 20.04(或者18.04就你的情况而言)
    5. 最后的选择是安装程序类型和你一样,我试过了deb(本地), 和运行文件(本地)都失败了。但有了选择deb(网络)我终于成功了。您可以轻松找到这组命令,但对您来说可能更成功。

相关内容