How to remove cuda-9.0 and install cuda-8.0 instead?

98,080

Solution 1

I got the exact same issue and managed to fix it. First observation was that the cuda-8 related entries in sources.list.d/ were commented out, but removing these and doing the dpkg --install of the cuda-8 repo did not repopulate the sources.list.d/ entries. What worked was to purge the 'dpkg' install (/var/cuda*) manually and doing the 'dpkg --install' again.

step by step:

  • dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 sudo dpkg --purge
  • dpkg --install cuda-repo-ubuntu*-8.0-local*.deb
  • sudo apt-get update
  • sudo apt-get install cuda

Solution 2

There's actually a script in /usr/local/cuda-9.x/bin/ which performs the uninstall process for you.

Solution 3

https://devtalk.nvidia.com/default/topic/1024342/cuda-setup-and-installation/unable-to-uninstall-cuda-9-0-completely-and-install-8-0-instead/

It works for me. It might be helpful for you too.

Solution 4

The official way is to run a uninstaller script:

Taken from nVidia documentation:

4.6. Uninstallation

To uninstall the CUDA Toolkit, run the uninstallation script provided in the bin directory of the toolkit. By default, go to /usr/local/cuda-9.1/bin and run

$ sudo ./uninstall_cuda_9.1.pl

Solution 5

I had to add "--force-all" to the purge command:

dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 sudo dpkg --purge --force-all
Share:
98,080

Related videos on Youtube

Jay Shin
Author by

Jay Shin

Updated on September 18, 2022

Comments

  • Jay Shin
    Jay Shin over 1 year

    I've been working on installing CUDA for TensorFlow usage.

    I realized that cuda-9.0 has been just released today, and I accidentally downloaded and dpkged it, and installed it on my machine.

    I realized that cuda-9.0 is not yet compatible with TensorFlow so I had to uninstall it with:

    sudo apt autoremove cuda
    

    Which did remove everything, but now whenever I try to install cuda-8.0, after downloading and dpkging, it prompts me to install cuda-9.0 instead.

    Now I know I can work around this with:

    sudo apt-get install cuda-8-0
    

    But I also need to install the patch, which can't be done this way.

    I've been trying many methods to resolve this issue:

    1. sudo apt-get remove cuda-9-0-blablal
    2. Removing the apt-key of cuda-9 with:
      • apt-key del [KEY]

    But none of these really worked.

    Can someone help me out?

    UPDATE

    Right after posting this, I figured out the answer, which turned out to be simple.

    I'm leaving it for others:

    I was able to solve it simply, by removing cuda-9 stuff from /etc/apt/sources.list.d/cuda-9-0-local.list

    UPDATE 2 And now I have another problem which is after

    sudo dpkg -i cuda-8-0-blabla

    none of it appears on sources.list.d anymore.

    • Jay Shin
      Jay Shin over 6 years
      Actually, I was able to solve it simply, by removing cuda-9 stuff from /etc/apt/sources.list.d/cuda-9-0-local.list
  • Jay Shin
    Jay Shin over 6 years
    In the end, I reinstalled Ubuntu.
  • Abhijay Ghildyal
    Abhijay Ghildyal over 6 years
    I had to first do, sudo apt-get --purge remove cuda and sudo apt autoremove, so as to remove Cuda 9. Then I installed Cuda 8
  • Magick
    Magick about 6 years
    What is the name of the script?
  • dashesy
    dashesy almost 6 years
    I guess the cuda-repo for all the versions is the same, because when I do "sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" then "sudo apt-get instll cuda" it tries to install version 9 still
  • dashesy
    dashesy almost 6 years
    had to use "apt-get install cuda-8.0" otherwise cuda-9 was always selected
  • Olivia Stork
    Olivia Stork almost 6 years
    @Magick I believe it should be something like /usr/local/cuda-9.2/bin/uninstall_cuda_9.2.pl. That's what this link says, but I don't have this file myself.
  • wordsforthewise
    wordsforthewise about 5 years
    saved my life!!
  • Eypros
    Eypros about 5 years
    This should provide with the actual commands in the answer not in a link. No matter how good a solution is it should be fully accessible from within SO.
  • Carlo Wood
    Carlo Wood about 4 years
    I don't have any such file (cuda-10.2). Also I think this is only the official way when you installed cude using a .run file, not when you use a .deb package manager.