How to uninstall CUDA Toolkit and cuDNN under Linux?

I have downloaded and installed the CUDA Toolkit 8 and cuDNN 5.1 for Ubuntu; now I would like to update to the latest release, and be sure the latest release is the only one installed on my system. How can I completely remove the currently installed CUDA Toolkit and cuDNN?


If you installed using the package manager method, instructions for uninstall are contained in the linux install guide. If you installed via package manager, you would use a remove call to your package manager.

cuDNN is just installed by dropping files onto your system. Study the install and delete those files.


Thank you for the link!

I have managed to uninstall CUDA with apt purge, and cuDNN just removing the directory where I had copied its libraries.

This might seem very trivial but I am very new to CUDA and stuuf. So I installed CUDA 9.0 and cudnn 7, but later I found out that I require CUDA 8 and cudnn 6 in my environment. So I would like to uninstall CUDA 9 and cudnn 7. I installed using the package manager. The installation document asks to use the following code to uninstall:

sudo apt-get --purge remove <package_name>

But what exactly is a ¨package_name¨, I dont know about that. May be a sample code will help.

Thanks a lot in advance.

<package_name> refers to the version of CUDA you installed. In your case, as you have installed CUDA 9.0 the command you should use is:

sudo apt-get --purge remove cuda-9.0

Hope it helps.

It worked, thanks a lot.

@robert_crovella the file/script that’s supposed exist in the instructions you cite, doesn’t exist.
“sudo /usr/local/cuda-10.2/bin/cuda-uninstaller”

That file is only present if there was a runfile install. If it was a package manager install, that file won’t be present. If you read the cuda linux install guide, you can discover this as well.