Score:1

CUDA can't be installed or uninstalled and dkpg can't install anything

us flag

When I do sudo apt --fix-broken install

    Errors were encountered while processing:
 /tmp/apt-dpkg-install-6CZ1pM/00-cuda-cudart-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/01-cuda-driver-dev-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/02-cuda-cudart-dev-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/03-cuda-nvcc-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/04-cuda-cupti-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/05-cuda-cupti-dev-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/06-cuda-nvprof-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/07-cuda-nvtx-11-0_11.0.167-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/08-cuda-nvrtc-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/09-cuda-nvrtc-dev-11-0_11.0.221-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/10-libcublas-11-0_11.2.0.252-1_amd64.deb
 /tmp/apt-dpkg-install-6CZ1pM/11-libcublas-dev-11-0_11.2.0.252-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

When I do sudo apt install aptitude

The following packages have unmet dependencies:
 aptitude : Depends: aptitude-common (= 0.8.12-1ubuntu4) but it is not going to be installed
            Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
            Depends: libxapian30 (>= 1.4.14~) but it is not going to be installed
            Recommends: libparse-debianchangelog-perl but it is not going to be installed
 cuda-command-line-tools-11-0 : Depends: cuda-cupti-dev-11-0 (>= 11.0.221) but it is not going to be installed
                                Depends: cuda-nvprof-11-0 (>= 11.0.221) but it is not going to be installed
                                Depends: cuda-nvtx-11-0 (>= 11.0.167) but it is not going to be installed
 cuda-compiler-11-0 : Depends: cuda-nvcc-11-0 (>= 11.0.221) but it is not going to be installed
 cuda-libraries-11-0 : Depends: cuda-cudart-11-0 (>= 11.0.221) but it is not going to be installed
                       Depends: cuda-nvrtc-11-0 (>= 11.0.221) but it is not going to be installed
                       Depends: libcublas-11-0 (>= 11.2.0.252) but it is not going to be installed
 cuda-libraries-dev-11-0 : Depends: cuda-cudart-dev-11-0 (>= 11.0.221) but it is not going to be installed
                           Depends: cuda-driver-dev-11-0 (>= 11.0.221) but it is not going to be installed
                           Depends: cuda-nvrtc-dev-11-0 (>= 11.0.221) but it is not going to be installed
                           Depends: libcublas-dev-11-0 (>= 11.2.0.252) but it is not going to be installed
 cuda-samples-11-0 : Depends: cuda-nvrtc-dev-11-0 but it is not going to be installed
                     Depends: cuda-nvcc-11-0 but it is not going to be installed
                     Depends: libcublas-dev-11-0 but it is not going to be installed
                     Depends: cuda-cudart-dev-11-0 but it is not going to be installed
                     Depends: cuda-driver-dev-11-0 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Any help would be appreciated, I'm new to this

Also tried

sudo apt-get clean
sudo apt-get -f install

could not find cuda file inside /usr/local however nvidia-smi saids CUDA version 11.4

AvSaba avatar
ru flag
Hello and welcome to askubuntu. I'm not posting this as an answer cause it's just a guess and I'm not sure if it fixes your problem but try `sudo dpkg --configure -a`
YH LIM avatar
us flag
Thx for the reply but I forgot to mention that I also tried that
Score:1
us flag

I think I've found the solution, it seems to be working now

Upgrade or uninstall cuda to allow apt-get to work

dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 sudo dpkg --purge
df -h
sudo apt-get purge nvidia*
sudo apt-get -f install
sudo apt autoremove
Score:0
in flag

An untested but similar answer that might work better...

sudo apt-get install $(dpkg -l | awk '/cuda-|nvidia-/ {print $2 "-"}' ) cuda

Basically, that allows all cuda and nvidia packages to be removed, and then installs cuda all in one step. This allows apt-get to keep anything that doesn't conflict and remove what does.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.