Unable to install CUDA

When trying to install CUDA on Ubuntu 16.04.03 using the runfile(local) option I encounter an error where the suggestion to solve it says:

nvidia-installer command line:
    ./nvidia-installer
    --ui=none
    --no-questions
    --accept-license
    --disable-nouveau
    --dkms

Using built-in stream user interface
-> Detected 4 CPUs online; setting concurrency level to 4.
-> License accepted by command line option.
-> Installing NVIDIA driver version 384.81.
-> Running distribution scripts
   executing: '/usr/lib/nvidia/pre-install'...
-> done.
-> The distribution-provided pre-install script failed!  Are you sure you want to continue? (Answer: Continue installation)
WARNING: One or more modprobe configuration files to disable Nouveau are already present at: /etc/modprobe.d/nvidia-installer-disable-nouveau.conf.  Please be sure you have rebooted your system since these files were written.  If you have rebooted, then Nouveau may be enabled for other reasons, such as being included in the system initial ramdisk or in your X configuration file.  Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how to correctly disable the Nouveau kernel driver.
-> For some distributions, Nouveau can be disabled by adding a file in the modprobe configuration directory.  Would you like nvidia-installer to attempt to create this modprobe file for you? (Answer: Yes)
-> One or more modprobe configuration files to disable Nouveau have been written.  For some distributions, this may be sufficient to disable Nouveau; other distributions may require modification of the initial ramdisk.  Please reboot your system and attempt NVIDIA driver installation again.  Note if you later wish to reenable Nouveau, you will need to delete these files: /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
-> Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later. (Answer: Yes)
-> Installing both new and classic TLS OpenGL libraries.
-> Installing both new and classic TLS 32bit OpenGL libraries.
-> Install NVIDIA's 32-bit compatibility libraries? (Answer: Yes)
-> Will install GLVND GLX client libraries.
-> Will install GLVND EGL client libraries.
-> Skipping GLX non-GLVND file: "libGL.so.384.81"
-> Skipping GLX non-GLVND file: "libGL.so.1"
-> Skipping GLX non-GLVND file: "libGL.so"
-> Skipping EGL non-GLVND file: "libEGL.so.384.81"
-> Skipping EGL non-GLVND file: "libEGL.so"
-> Skipping EGL non-GLVND file: "libEGL.so.1"
-> Skipping GLX non-GLVND file: "./32/libGL.so.384.81"
-> Skipping GLX non-GLVND file: "libGL.so.1"
-> Skipping GLX non-GLVND file: "libGL.so"
-> Skipping EGL non-GLVND file: "./32/libEGL.so.384.81"
-> Skipping EGL non-GLVND file: "libEGL.so"
-> Skipping EGL non-GLVND file: "libEGL.so.1"
Looking for install checker script at ./libglvnd_install_checker/check-libglvnd-install.sh
   executing: '/bin/sh ./libglvnd_install_checker/check-libglvnd-install.sh'...
   Checking for libglvnd installation.
   Checking libGLdispatch...
   Checking libGLdispatch dispatch table
   Checking call through libGLdispatch
   All OK
   libGLdispatch is OK
   Checking for libGLX
   libGLX is OK
   Checking for libEGL
   Got EGL_VENDOR string "NVIDIA", expected "DUMMY VENDOR"
An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries. (Answer: Abort installation.)

I tried to install the libglvnd library manually but had no success so far.

Moreover, I also tried to install it using the cluster(local) version but when trying to install cuda-cluster-runtime-9-0_9.0.176-1_amd64.deb I get the error

Preparing to unpack cuda-cluster-runtime-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cluster-runtime-9-0 (9.0.176-1) ...
dpkg: error processing archive cuda-cluster-runtime-9-0_9.0.176-1_amd64.deb (--install):
 trying to overwrite '/usr/local/cuda-9.0/version.txt', which is also in package cuda-license-9-0 9.0.176-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 cuda-cluster-runtime-9-0_9.0.176-1_amd64.deb

I’ve been trying to install CUDA for a few hours now and I’m lost as to what else I could try. Any help would be really appreciated.

I have the same error trying to install CUDA drivers through runfile. Was you able to resolve this issue? Many thanks.

Before install try:

apt purge nvidia*

Thanks, this solved my problem.

this solved my problem:
sudo apt install nvidia-cuda-toolkit

I have the same problem, I tried to install it in ubuntu 17.10 it did not work,
I’m trying to install int to ubuntu 16.4,

so at which point to I need to use this command “sudo apt install nvidia-cuda-toolkit” ? before installing cuda or after it has failed to install