Attempting to remove a package complains about unmet dependencies
Solution 1
I had the same problem. This saved me (replace with your package version):
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libcublas-dev_10.2.1.243-1_amd64.deb
And then:
sudo apt --fix-broken install
Solution 2
dpkg: error processing archive /var/cuda-repo-10-1-local-10.1.243-418.87.00/./libcublas-dev_10.2.1.243-1_amd64.deb (--unpack): trying to overwrite '/usr/lib/x86_64-linux-gnu/libcublas_static.a', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
2 Packages ,that have the same file
sudo mv usr/lib/x86_64-linux-gnu/libcublas_static.a usr/lib/x86_64-linux-gnu/libcublas_static.a.bak
Then
sudo dpkg --configure -a
If this work, try to purge cuda again
Solution 3
Unpacking libcublas-dev (10.2.1.243-1) ...
dpkg: error processing archive /var/cuda-repo-10-1-local-10.1.243-418.87.00/./libcublas-dev_10.2.1.243-1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/libcublas_static.a', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
Let's explain this error a bit: You have two packages that are incompatible because each tries to provide the same file. The two packages are libcublas-dev
(from CUDA) and nvidia-cuda-dev
(from Ubuntu).
The file that they both try to provide is /usr/lib/x86_64-linux-gnu/libcublas_static.a
You have several options.
You can give up on CUDA, uninstall the CUDA packages, and delete the CUDA repositories.
You can uninstall the NVIDIA package. DON'T delete the Ubuntu repositories.
You can use dpkg's
--force-overwrite
flag to make the two otherwise-incompatible packages work together. Then you needn't uninstall or delete anything.sudo apt install --force-overwrite libcublas-dev
Using
--force
should be done with care. It might cause future problems with upgrades, removals, or other package actions. Be sure to document in your own notes that you needed to use--force-overwrite
to install CUDA and NVIDIA packages together.
Related videos on Youtube
Karnivaurus
Updated on September 18, 2022Comments
-
Karnivaurus over 1 year
On Ubuntu 18.04, I am having some problems with my installation of CUDA, so I would like to uninstall CUDA and start from scratch.
So, I tried the following:
sudo apt remove cuda
But this then printed out the following:
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. cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not going to be installed cuda-samples-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not going to be installed cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I am very confused by this. It seems to be telling me that
cuda-libraries-dev-10-1
,cuda-samples-10-1
, andcuda-visual-tools-10-1
all depend onlibcublas-dev
, with at least version 10.2.1.243. And then it is saying that this version oflibcublas-dev
is not going to be installed. But I am trying to unistall CUDA, not install it. Therefore, why should my system care that some of the packages that come with CUDA have unmet dependencies, when I am trying to remove these packages anyway?I can understand that if I was trying to install
cuda-libraries-dev-10-1
,cuda-samples-10-1
, orcuda-visual-tools-10-1
, then this message would make sense. But if I am trying to remove these, who cares whether they have unmet dependencies?
Update
As suggested, I also ran:
apt --fix-broken install
This then printed out:
Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: g++-6 libaccinj64-9.1 libcublas9.1 libcudart9.1 libcufft9.1 libcufftw9.1 libcuinj64-9.1 libcurand9.1 libcusolver9.1 libcusparse9.1 libnppc9.1 libnppial9.1 libnppicc9.1 libnppicom9.1 libnppidei9.1 libnppif9.1 libnppig9.1 libnppim9.1 libnppist9.1 libnppisu9.1 libnppitc9.1 libnpps9.1 libnvblas9.1 libnvgraph9.1 libnvrtc9.1 libnvtoolsext1 libnvvm3 libstdc++-6-dev libthrust-dev libvdpau-dev nvidia-cuda-dev nvidia-cuda-doc nvidia-cuda-gdb nvidia-opencl-dev nvidia-profiler nvidia-visual-profiler ocl-icd-opencl-dev opencl-c-headers Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libcublas-dev The following NEW packages will be installed libcublas-dev 0 to upgrade, 1 to newly install, 0 to remove and 62 not to upgrade. 83 not fully installed or removed. Need to get 0 B/38.9 MB of archives. After this operation, 109 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 libcublas-dev 10.2.1.243-1 [38.9 MB] (Reading database ... 211122 files and directories currently installed.) Preparing to unpack .../libcublas-dev_10.2.1.243-1_amd64.deb ... Unpacking libcublas-dev (10.2.1.243-1) ... dpkg: error processing archive /var/cuda-repo-10-1-local-10.1.243-418.87.00/./libcublas-dev_10.2.1.243-1_amd64.deb (--unpack): trying to overwrite '/usr/lib/x86_64-linux-gnu/libcublas_static.a', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe) Errors were encountered while processing: /var/cuda-repo-10-1-local-10.1.243-418.87.00/./libcublas-dev_10.2.1.243-1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
Update
As suggested in the comments, I then tried running:
sudo apt full-upgrade
This printed out the following:
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. cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not installed cuda-samples-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not installed cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
This is exactly the same print out as when I ran
sudo apt remove cuda
.
Update
As suggested in the comments, I ran
grep -r deb /etc/apt/sources.list /etc/apt/sources.list.d
. This gave the following output:/etc/apt/sources.list:#deb cdrom:[Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805)]/ bionic main restricted /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic main restricted /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic main restricted /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic-updates main restricted /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates main restricted /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic universe /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic universe /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic-updates universe /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates universe /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic multiverse /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic multiverse /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic-updates multiverse /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates multiverse /etc/apt/sources.list:deb http://gb.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse /etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse /etc/apt/sources.list:# deb http://archive.canonical.com/ubuntu bionic partner /etc/apt/sources.list:# deb-src http://archive.canonical.com/ubuntu bionic partner /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security main restricted /etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security universe /etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu bionic-security universe /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security multiverse /etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse /etc/apt/sources.list.d/cuda.list:deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 / /etc/apt/sources.list.d/cuda-10-0-local-10.0.130-410.48.list:deb file:///var/cuda-repo-10-0-local-10.0.130-410.48 / /etc/apt/sources.list.d/cuda-10-1-local-10.1.243-418.87.00.list:deb file:///var/cuda-repo-10-1-local-10.1.243-418.87.00 /
-
Murphy over 4 years
apt
is telling you twice to runapt --fix-broken install
. Have you tried that? -
Karnivaurus over 4 years@Murphy Yes I have run this, and have updated my question with the result
-
DK Bose over 4 yearsYour system seems to be having issues beyond just CUDA. Run
sudo apt update
and thensudo apt full-upgrade
. Post the entire output here. -
Karnivaurus over 4 years@DKBose I have just tried this, and updated my question with the result
-
DK Bose over 4 yearsDid you first run
sudo apt update
? Where is that output? -
Karnivaurus over 4 yearsYes, I did. The output printed a few lines, the final line being:
62 packages can be upgraded. Run 'apt list --upgradable' to see them.
. So I ranapt list --upgradeable
, and of the 62 packages listed, the only one containingcuda
is:cuda-repo-ubuntu1804/unknown 10.1.243-1 amd64 [upgradable from: 10.0.130-1]
-
-
Karnivaurus over 4 yearsI ran
sudo mv /usr/lib/x86_64-linux-gnu/libcublas_static.a /usr/lib/x86_64-linux-gnu/libcublas_static.a.bak
, and thensudo dpkg --configure -a
, which printed out a number of errors. For example:dpkg: dependency problems prevent configuration of cuda-visual-tools-10-1: cuda-visual-tools-10-1 depends on libcublas-dev (>= 10.2.1.243); however: Package libcublas-dev is not installed.
anddpkg: error processing package cuda-visual-tools-10-1 (--configure): dependency problems - leaving unconfigured
. -
nobody over 4 years
grep -r deb /etc/apt/sources.list /etc/apt/sources.list.d
please edit your question for output. -
Karnivaurus over 4 yearsThank you -- I have done this and added the output to my question.
-
Karnivaurus over 4 yearsThanks for your reply. I understand this a little better now, and I'd like to go with option 2 and just install with the CUDA package (i.e. the .deb file I downloaded from the CUDA website). However, I'm not sure how to uninstall the Ubuntu package. If I just run 'sudo apt remove cuda', then this was the cause of the original post I created. In
apt remove cuda
, how do I know which packagecuda
is actually referring to? How can I make it refer to the Ubuntu package, rather than the CUDA package? -
user535733 over 4 years"
cuda
" doesn't refer to anything. You must use the complete, correctly-spelled package names. Happily, the complete, correctly-spelled package names are already in the output you provided. For example, the Ubuntu-provided package isnvidia-cuda-dev
. Note that if you installed that package for some other reason (like, say, NVIDIA compatibility), you may wish to investigate the consequences of removal so you're not surprised if your displays go blank. -
Karnivaurus over 4 yearsThanks. I tried
sudo apt remove nvidia-cuda-dev
, but this output:The following packages have unmet dependencies. cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not going to be installed cuda-samples-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not going to be installed cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.2.1.243) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
It's the same if I runsudo apt remove libcublas-dev
. -
user535733 over 4 yearsOf course it's the same: Apt remembers what you tell it to do, and keeps trying every time you start it. Try using dpkg instead for the removal, then apt for the installs.
-
mgabz over 4 yearsThis should be accepted as answer!! Thanks for posting.
-
dia almost 4 yearsYES THIS IS GOLDEN. THANK YOU!