Ubuntu remove Nvidia Cuda drivers. Want to remove the installed earlier and install a new Cuda toolkit? Applies to Ubuntu and some other Linux OS`s.
For Cuda drivers below 10.x
Uninstall only nvidia-cuda-toolkit:
sudo apt-get remove nvidia-cuda-toolkit
Uninstall nvidia-cuda-toolkit with its dependencies:
sudo apt-get remove --auto-remove nvidia-cuda-toolkit
Purging config/data:
sudo apt-get purge nvidia-cuda-toolkit or sudo apt-get purge --auto-remove nvidia-cuda-toolkit
Additionally, delete the /opt/cuda
and ~/NVIDIA_GPU_Computing_SDK
folders if they are present. and remove the export PATH=$PATH:/opt/cuda/bin
and export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64
lines of the ~/.bash_profile
file.
.deb installation
This is for whom use *.deb files to install Cuda.
sudo apt-get autoremove --purge cuda
This can clear the Cuda clearly. You can check that the folder /usr/local/cuda
gone. And this command is the best choice to remove *.apt installed app.
But when you reinstall another version of Cuda, you must use:
sudo apt-get install cuda-x.x
NOTE: The version number must be included
For CUDA 10.x or higher
Use Cuda uninstaller:
sudo /usr/local/cuda/bin/cuda-uninstaller