我真的很想删除所有的 cuda 和 cudnn 包,但我根本无法使用 apt-get,因为它总是会出现这个错误。我尝试了很多不同的方法。我甚至在 synaptic 中找到了损坏的包,即 nvidia-cuda-toolkit 9.1.85-3ubuntu1。我知道这可能是一个愚蠢的问题,但我被困住了。救命 : )。
(base) itamar@itamar-PC:~$ sudo apt-get install nvidia-cuda-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libatomic1:i386 libbsd0:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386
libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386
libelf1:i386 libexpat1:i386 libffi6:i386 libgl1:i386 libgl1-mesa-dri:i386
libglapi-mesa:i386 libglvnd0:i386 libglx-mesa0:i386 libglx0:i386
libllvm8:i386 libnvidia-common-430 libpciaccess0:i386 libsensors4:i386
libstdc++6:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386
libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386
libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386
libxfixes3:i386 libxshmfence1:i386 libxxf86vm1:i386
Use 'sudo apt autoremove' to remove them.
Recommended packages:
libvdpau-dev libnvcuvid1
The following NEW packages will be installed:
nvidia-cuda-dev
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 0 B/263 MB of archives.
After this operation, 734 MB of additional disk space will be used.
Selecting previously unselected package nvidia-cuda-dev.
(Reading database ... 280498 files and directories currently installed.)
Preparing to unpack .../nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb ...
Unpacking nvidia-cuda-dev (9.1.85-3ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb (--unpack):
trying to overwrite '/usr/include/cublas.h', which is also in package libcublas-dev 10.2.2.89-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
(base) itamar@itamar-PC:~$ sudo apt autoremove
Reading package lists... Done
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:
nvidia-cuda-toolkit : Depends: nvidia-cuda-dev (= 9.1.85-3ubuntu1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
答案1
我遇到了同样的问题。尝试了 user535733 推荐的方法,但收到错误。我没有nvidia-cuda-dev
安装,所以无法删除它。但是,nvidia-cuda-toolkit
是一个依赖项,所以我删除了它。这似乎解决了我的问题,但现在我没有nvidia-cuda-toolkit
!所以这对我来说没什么用,但似乎是 @itamar-rocha 正在寻找的。然后我能够sudo apt autoremove
清理大约 5GB 的空间。
我只是希望nvidia-toolkit
安装时不会发生冲突,也不会覆盖其他包。
答案2
我遇到这个问题已经有一段时间了,下面是我修复它的方法:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb
sudo apt --fix-broken install
要搜索您的cuda-dev
版本,请执行ls
以下操作/var/cache/apt/archives/
。
希望这对您有所帮助。