Ubuntu – How to remove cuda-9.0 and install cuda-8.0 instead


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?


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

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.

Best Answer

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
Related Question