Installing Drivers and CUDA

I want to install the nvidia drivers and CUDA, and followed a set of instructions:

Firstly
I installed NVIDIA drivers
Let me give you the process I followed:

sudo apt-get purge nvidia*
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt-get install nvidia-XYXYX
sudo reboot
nvidia-smi ( I have attached a screenshot )
lsmod | grep nouveau (gave no output)

Step 2: Installing CUDA
I have followed the instructions from here and after running the command

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

I want to install tensor flow on my ubuntu and then I follow instructions from here

But after running few commands, I get error,this is displayed in the terminal:

= Summary =
===========
Driver: Installation Failed
Toolkit: Installation skipped
Samples: Installation skipped

I have attached the image of my log file:

the steps I followed from the instructions in the second link are:

$ cd ~
$ mkdir installers
$ cd installers/
$wget
{this bracket was necessary to prevent making a hyperlink, as new users can put only 2 hyperlinks in a topic-https}://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux
$ mv cuda_10.0.130_410.48_linux cuda_10.0.130_410.48_linux.run
$ chmod +x cuda_10.0.130_410.48_linux.run
$ sudo ./cuda_10.0.130_410.48_linux.run --override

Would be grateful for any help. Thanks a lot for being patient.