Ubuntu – Removing Nvidia CUDA Toolkit and installing new one

bumblebeecudadriversnvidiauninstall

I installed the CUDA 5.5 package on Ubuntu 14.04 (which is not supported for this version of Ubuntu version) , and I didn't do it well.

I want to remove what I've installed earlier and install a new CUDA 6.5 toolkit,

After typing this in the terminal: dpkg -l | grep -i nvidia,

I get the following output:

ii  bbswitch-dkms                                         0.8-1~trustyppa1                                    all          Interface for toggling the power on NVIDIA Optimus video cards
ii  bumblebee                                             3.2.1-90~trustyppa1                                 amd64        NVIDIA Optimus support
ii  bumblebee-nvidia                                      3.2.1-90~trustyppa1                                 amd64        NVIDIA Optimus support using the proprietary NVIDIA driver
ii  libcublas5.5:amd64                                    5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA BLAS runtime library
ii  libcuda1-331                                          331.38-0ubuntu7.1                                   amd64        NVIDIA CUDA runtime library
ii  libcudart5.5:amd64                                    5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA runtime library
ii  libcufft5.5:amd64                                     5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA FFT runtime library
ii  libcufftw5.5:amd64                                    5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA FFTW runtime library
ii  libcuinj64-5.5:amd64                                  5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA INJ runtime library (64-bit)
ii  libcurand5.5:amd64                                    5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA Random Numbers Generation runtime library
ii  libcusparse5.5:amd64                                  5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA Sparse Matrix runtime library
ii  libnppc5.5:amd64                                      5.5.22-3ubuntu1                                     amd64        NVIDIA Performance Primitives core runtime library
ii  libnppi5.5:amd64                                      5.5.22-3ubuntu1                                     amd64        NVIDIA Performance Primitives for image processing runtime library
ii  libnpps5.5:amd64                                      5.5.22-3ubuntu1                                     amd64        NVIDIA Performance Primitives for signal processing runtime library
ii  libnvtoolsext1:amd64                                  5.5.22-3ubuntu1                                     amd64        NVIDIA Tools Extension
ii  libnvvm2:amd64                                        5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA Compiler NVVM runtime library
ii  nvidia-331                                            331.38-0ubuntu7.1                                   amd64        NVIDIA binary driver - version 331.38
ii  nvidia-cuda-dev                                       5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA development files
ii  nvidia-cuda-doc                                       5.5.22-3ubuntu1                                     all          NVIDIA CUDA and OpenCL documentation
ii  nvidia-cuda-gdb                                       5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA GDB
ii  nvidia-cuda-toolkit                                   5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA toolkit
ii  nvidia-libopencl1-331                                 331.38-0ubuntu7.1                                   amd64        NVIDIA OpenCL Driver and ICD Loader library
ii  nvidia-nsight                                         5.5.22-3ubuntu1                                     amd64        NVIDIA Nsight Eclipse Edition
ii  nvidia-opencl-dev:amd64                               5.5.22-3ubuntu1                                     amd64        NVIDIA OpenCL development files
ii  nvidia-opencl-icd-331                                 331.38-0ubuntu7.1                                   amd64        NVIDIA OpenCL ICD
ii  nvidia-profiler                                       5.5.22-3ubuntu1                                      amd64        NVIDIA Profiler for CUDA and OpenCL
ii  nvidia-settings                                       331.20-0ubuntu8                                     amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-visual-profiler                                5.5.22-3ubuntu1                                     amd64        NVIDIA Visual Profiler
ii  primus

I'd like to remove only what is needed to install the newest CUDA toolkit. Packages, like bumblebee, I want to remain as they are.

Which packages should I remove and which should not be removed to get this done?

Best Answer

This method will give a complete removal of Cuda:

Simple

remove the CUDA files in /usr/local/cuda-5.0


Advanced


Uninstall just nvidia-cuda-toolkit

sudo apt-get remove nvidia-cuda-toolkit

Uninstall nvidia-cuda-toolkit and it's 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

Related Question