我正在尝试安装 nvidia-docker (https://github.com/NVIDIA/nvidia-docker)当我运行时:
sudo apt-get install -y nvidia-container-toolkit
我得到:
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-drivers : Depends: nvidia-compute-utils-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-dkms-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-driver-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-kernel-common-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-kernel-source-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-utils-418 (>= 418.67) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-418 (>= 418.67) but it is not going to be installed
libnvidia-gl-418 : Depends: libnvidia-gl-430 but it is not going to be installed
libnvidia-ifr1-430 : Depends: libnvidia-gl-430 but it is not going to be installed
nvidia-container-toolkit : Depends: libnvidia-container-tools (>= 0.1.0) but it is not going to be installed
Depends: libnvidia-container-tools (< 2.0.0) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
现在如果我这样做:
sudo apt --fix-broken install
我得到:
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
lib32gcc1 libc6-i386 ocl-icd-libopencl1 xserver-xorg-legacy
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libnvidia-cfg1-430 libnvidia-gl-430 nvidia-compute-utils-418 nvidia-compute-utils-430 nvidia-dkms-418 nvidia-dkms-430 nvidia-driver-418 nvidia-driver-430
nvidia-kernel-common-418 nvidia-kernel-common-430 nvidia-kernel-source-418 nvidia-kernel-source-430 nvidia-utils-418 nvidia-utils-430
xserver-xorg-video-nvidia-418 xserver-xorg-video-nvidia-430
Recommended packages:
libnvidia-compute-430:i386 libnvidia-decode-430:i386 libnvidia-encode-430:i386 libnvidia-ifr1-430:i386 libnvidia-fbc1-430:i386 libnvidia-gl-430:i386
The following packages will be REMOVED:
nvidia-418 nvidia-418-dev
The following NEW packages will be installed:
libnvidia-cfg1-430 libnvidia-gl-430 nvidia-compute-utils-418 nvidia-compute-utils-430 nvidia-dkms-418 nvidia-dkms-430 nvidia-driver-418 nvidia-driver-430
nvidia-kernel-common-418 nvidia-kernel-common-430 nvidia-kernel-source-418 nvidia-kernel-source-430 nvidia-utils-418 nvidia-utils-430
xserver-xorg-video-nvidia-418 xserver-xorg-video-nvidia-430
0 upgraded, 16 newly installed, 2 to remove and 11 not upgraded.
6 not fully installed or removed.
Need to get 0 B/47.2 MB of archives.
After this operation, 228 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 117044 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-430_430.40-0ubuntu0~gpu18.04.1_amd64.deb ...
Unpacking libnvidia-gl-430:amd64 (430.40-0ubuntu0~gpu18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-430_430.40-0ubuntu0~gpu18.04.1_amd64.deb (--unpack):
trying to overwrite '/usr/share/glvnd/egl_vendor.d/10_nvidia.json', which is also in package nvidia-418 418.67-0ubuntu1
Errors were encountered while processing:
/var/cache/apt/archives/libnvidia-gl-430_430.40-0ubuntu0~gpu18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
问题仍未解决。
我尝试了几种方法:使用参数安装所有东西-f
,尝试清除 cuda 驱动程序,安装 aptitude,但所有这些都给我依赖项错误。例如,如果我尝试安装 aptitude,(使用sudo apt-get install aptitude
)我得到:
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: aptitude-common (= 0.8.10-6ubuntu1) but it is not going to be installed
Depends: libboost-filesystem1.65.1 but it is not going to be installed
Depends: libboost-iostreams1.65.1 but it is not going to be installed
Depends: libboost-system1.65.1 but it is not going to be installed
Depends: libcwidget3v5 but it is not going to be installed
Depends: libsigc++-2.0-0v5 (>= 2.8.0) but it is not going to be installed
Depends: libxapian30 but it is not going to be installed
Recommends: libparse-debianchangelog-perl but it is not going to be installed
cuda-drivers : Depends: nvidia-compute-utils-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-dkms-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-driver-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-kernel-common-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-kernel-source-418 (>= 418.67) but it is not going to be installed
Depends: nvidia-utils-418 (>= 418.67) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-418 (>= 418.67) but it is not going to be installed
libnvidia-gl-418 : Depends: libnvidia-gl-430 but it is not going to be installed
libnvidia-ifr1-430 : Depends: libnvidia-gl-430 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
当然,这并不能按照建议得到修复apt --fix-broken install
。
我已经安装了 CUDA 驱动程序版本 10.1:
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Apr_24_19:10:27_PDT_2019
Cuda compilation tools, release 10.1, V10.1.168
如果有帮助的话。
任何帮助都将不胜感激。谢谢!
答案1
上周末我在克隆分区上将 Ubuntu 16.04.6 LTS 升级到 Ubuntu 19.04 时遇到了类似的情况。您可能也想在克隆上尝试此修复。要创建克隆,请参阅:
这个与 nvidia Cuda 相关的答案与我所做的和你可以尝试的类似(有点冒险):
你的命令将会像这样:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libnvidia-gl-430_430.40-0ubuntu0~gpu18.04.1_amd64.deb
答案2
免责声明:将此作为最后的手段。这可能会导致您的 NVIDIA 驱动程序损坏。
只需消除问题:
sudo rm -rf /usr/share/glvnd/egl_vendor.d/10_nvidia.json
sudo apt -f install