我对 Linux 还很陌生。我尝试在 Linux 系统上安装 CUDA 库来进行一些 ML 实验。但是,由于一些损坏的 cuda 软件包,几周以来我一直无法更新我的系统?
我的问题基本上如下:
sudo apt update
Get:1 file:/var/cuda-repo-ubuntu2204-11-8-local InRelease [1.575 B]
Get:2 file:/var/cuda-repo-ubuntu2204-12-2-local InRelease [1.572 B]
Get:3 file:/var/cuda-repo-ubuntu2204-12-3-local InRelease [1.572 B]
Get:1 file:/var/cuda-repo-ubuntu2204-11-8-local InRelease [1.575 B]
Get:4 file:/var/cudnn-local-repo-ubuntu2204-8.9.6.50 InRelease [1.572 B]
Get:2 file:/var/cuda-repo-ubuntu2204-12-2-local InRelease [1.572 B]
Get:3 file:/var/cuda-repo-ubuntu2204-12-3-local InRelease [1.572 B]
Get:4 file:/var/cudnn-local-repo-ubuntu2204-8.9.6.50 InRelease [1.572 B]
Get:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:6 https://downloads.plex.tv/repo/deb public InRelease
Hit:7 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:8 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease
Hit:9 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 InRelease
Hit:10 http://be.archive.ubuntu.com/ubuntu jammy InRelease
Get:11 http://be.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Hit:12 https://repo.jellyfin.org/ubuntu jammy InRelease
Hit:13 http://be.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:14 https://nvidia.github.io/libnvidia-container/stable/deb/amd64 InRelease
Hit:15 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease
Fetched 229 kB in 1s (205 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
117 packages can be upgraded. Run 'apt list --upgradable' to see them.
我运行:
sudo apt install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-command-line-tools-12-3 : Depends: cuda-cupti-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-nvprof-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-nvtx-12-3 (>= 12.3.101) but 12.3.52-1 is installed
cuda-compiler-12-3 : Depends: cuda-cuxxfilt-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-nvcc-12-3 (>= 12.3.103) but 12.3.52-1 is installed
cuda-libraries-12-3 : Depends: cuda-cudart-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-nvrtc-12-3 (>= 12.3.103) but 12.3.52-1 is installed
Depends: cuda-opencl-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: libcublas-12-3 (>= 12.3.4.1) but 12.3.2.9-1 is installed
Depends: libcufft-12-3 (>= 11.0.12.1) but 11.0.11.19-1 is installed
Depends: libcurand-12-3 (>= 10.3.4.101) but 10.3.4.52-1 is installed
Depends: libcusolver-12-3 (>= 11.5.4.101) but 11.5.3.52-1 is installed
Depends: libcusparse-12-3 (>= 12.2.0.103) but 12.1.3.153-1 is installed
Depends: libnpp-12-3 (>= 12.2.3.2) but 12.2.2.32-1 is installed
Depends: libnvjitlink-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: libnvjpeg-12-3 (>= 12.3.0.81) but 12.2.3.32-1 is installed
cuda-libraries-dev-12-3 : Depends: cuda-cudart-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-cccl-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-profiler-api-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-driver-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: cuda-nvrtc-dev-12-3 (>= 12.3.103) but 12.3.52-1 is installed
Depends: cuda-opencl-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: libcublas-dev-12-3 (>= 12.3.4.1) but 12.3.2.9-1 is installed
Depends: libcufft-dev-12-3 (>= 11.0.12.1) but 11.0.11.19-1 is installed
Depends: libcurand-dev-12-3 (>= 10.3.4.101) but 10.3.4.52-1 is installed
Depends: libcusolver-dev-12-3 (>= 11.5.4.101) but 11.5.3.52-1 is installed
Depends: libcusparse-dev-12-3 (>= 12.2.0.103) but 12.1.3.153-1 is installed
Depends: libnpp-dev-12-3 (>= 12.2.3.2) but 12.2.2.32-1 is installed
Depends: libnvjitlink-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
Depends: libnvjpeg-dev-12-3 (>= 12.3.0.81) but 12.2.3.32-1 is installed
cuda-nvcc-12-3 : Depends: cuda-nvvm-12-3 (= 12.3.52-1) but 12.3.103-1 is installed
Depends: cuda-crt-12-3 (= 12.3.52-1) but 12.3.103-1 is installed
cuda-toolkit-12-3 : Depends: cuda-nvml-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
cuda-visual-tools-12-3 : Depends: cuda-nvml-dev-12-3 (>= 12.3.101) but 12.3.52-1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
然后当我尝试
sudo apt --fix-broken install
我得到以下信息:
...*long code paragraphs*
101-1_amd64.deb ...
Unpacking cuda-nvml-dev-12-3 (12.3.101-1) over (12.3.52-1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-VjvbGI/31-cuda-nvml-dev-12-3_12.3.101-1_amd64.deb (--unpack)
:
trying to overwrite '/usr/local/cuda-12.3/include', which is also in package cuda-cccl-12-3 12.3.52-1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
/tmp/apt-dpkg-install-VjvbGI/00-cuda-cupti-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/01-cuda-cupti-dev-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/02-cuda-nvprof-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/03-cuda-nvtx-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/04-cuda-cuxxfilt-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/05-cuda-cudart-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/06-cuda-cccl-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/07-cuda-driver-dev-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/08-cuda-cudart-dev-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/09-cuda-nvcc-12-3_12.3.103-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/10-cuda-nvrtc-12-3_12.3.103-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/11-cuda-opencl-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/12-libcublas-12-3_12.3.4.1-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/13-libcufft-12-3_11.0.12.1-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/14-libcurand-12-3_10.3.4.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/15-libcusolver-12-3_11.5.4.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/16-libcusparse-12-3_12.2.0.103-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/17-libnpp-12-3_12.2.3.2-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/18-libnvjitlink-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/19-libnvjpeg-12-3_12.3.0.81-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/20-cuda-profiler-api-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/21-cuda-nvrtc-dev-12-3_12.3.103-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/22-cuda-opencl-dev-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/23-libcublas-dev-12-3_12.3.4.1-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/24-libcufft-dev-12-3_11.0.12.1-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/25-libcurand-dev-12-3_10.3.4.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/26-libcusolver-dev-12-3_11.5.4.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/27-libcusparse-dev-12-3_12.2.0.103-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/28-libnpp-dev-12-3_12.2.3.2-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/29-libnvjitlink-dev-12-3_12.3.101-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/30-libnvjpeg-dev-12-3_12.3.0.81-1_amd64.deb
/tmp/apt-dpkg-install-VjvbGI/31-cuda-nvml-dev-12-3_12.3.101-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人能告诉我如何解决这个问题吗?
答案1
欢迎来到 CUDA 和 NVIDIA 的精彩世界 :-)
基本上,您(很可能)正在尝试更新您的 CUDA 安装,但其更新与您安装的 NVIDIA 驱动程序不兼容。这通常是由于从您的发行版安装 NVIDA 驱动程序,然后通过 NVIDIA 开发人员 CUDA 工具包 [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html] 安装 CUDA 造成的。
解决方案是 (a) 等待您的发行版更新其驱动程序包,以便版本号满足 CUDA 更新要求,或 (b) 删除/清除已安装的 NVIDIA 驱动程序,然后安装 NVIDIA 驱动程序和 NVIDIA 的 CUDA。坏处第二种方法的优点是,DISTRO 维护人员通常会对 NVIDIA 软件包进行一些特殊调整,以减轻其特定发行版的任何问题。