Nvidia Driver and CUDA Installation Sequence !

Hi Everyone,I am about to loose my mind !

I installed Ubuntu 16.04 LTS. My computer has an integrated Intel VGA and a GPU which is Nvidia GTX 1070. As you can predict, I installed the latest Nvidia GPU driver (390.48) and CUDA 9.1 respectively. I also did vice versa. However both sequences ended up with problem. (I applied almost 10 methods from the internet, especially NVIDIA CUDA installation guide for Linux) Here are the steps that I applied:

1) I installed Nvidia GPU driver version of 390.48 from nvidia.com. According to https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07?_pjax=%23gist-pjax-container (via run file). That installation was completed without any problem and I was able to use my GPU. Afterwards, I installed CUDA 9.1 regarding https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html. However, after installation of CUDA, I got a few problems which are;

By the way, I applied this installation sequence a few times.So, the problems that I indicated below are the result of trials. (for each trial, I always formatted the disk and reinstalled Ubuntu)

  • System installation failed because of nvidia driver version of 387 although I installed version of 390.
  • After Installation of Cuda 9.1 after installing gpu driver, driver version of 390.48 reverted to 388.11.
  • and so on…

Again, I reinstalled Ubuntu by formatting and deleting everything in it.

2) I installed Cuda 9.1 and GPU driver version of 390.48 respectively (vice versa of above). This time, again, during the installation of CUDA 9.1, I got the error of fail of nvidia driver installation. So, I installed Nvidia driver version of 390.48 by removing pre-installed nvidia files and things. Still I got nothing except fails.

Please give some advices or solution for this problem. I need to install GPU driver 390.48 and CUDA 9.1. By the way, I have almost tried every solution on the internet, including Nvidia Guides. Where am i doing wrong ?

1 Like

Follow your first method where you got 390.48 via runfile installed and were happy with that. I assume you can repeat that step.

Then use the CUDA runfile installer to install CUDA 9.1, and answer “no” when prompted to install the driver. It will then keep your 390.48 driver intact.

Alternatively, if you are going to install using the deb installer (which is what was installing 387 driver etc.) then you could just do:

sudo apt-get install cuda-toolkit

instead of

sudo apt-get install cuda

and that should skip the driver install as well.

I am following your instructions. I installed GPU driver successfully. Now, I am installing CUDA via runfile (first time to me). I need your help please if possible.

According to step of 4.2 Installation in Cuda installation guide, what is “3. Reboot into text mode (runlevel 3).” As you know and recommended me to install gpu driver first, I have already installed driver. So, should i skip this step ?

yes, you can skip that

Hi again,

I installed Nvidia GPU driver and Cuda 9.1 successfully. However, after rebootin my notebook, CUDA disappeared. I mean,

nvcc --version

gave this output:

The program ‘nvcc’ is currently not installed. You can install it by typing:
sudo apt install nvidia-cuda-toolkit

If i apply sudo apt install nvidia-cuda-toolkit , my latest GPU driver version will revert to an old version. I know because I experienced that. What can I do to avoid this problem. I just want to install CUDA and GPU driver and use them. That’s all. Nothing more.

Please explain me why and provide a pinpoint accurate solution. I am enough and too and too tired. I am not sleeping for 2 days. I installed regarding Nvidia’s Guide. And everything was okay until rebooting.

Follow the post install instructions in the install guide.

Specifically, set your PATH and LD_LIBRARY_PATH variables.

I followed it. Regarding the guide, set LD_LIBRARY_PATH variables when runfile installation method is used, right? I did not install using runfile but .deb.
I have just set

export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}

What is the output of:

echo $PATH


ls /usr/local/cuda-9.1


sudo find / -name nvcc

echo $PATH



ls /usr/local/cuda-9.1

gives: bin extras lib64 libnvvp nsightee_plugins nvvm samples src tools
doc include libnsight LICENSE nvml README share targets version.txt

sudo find / -name nvcc

gives: find: ‘/run/user/1000/gvfs’: Permission denied

everything is fine. CUDA 9.1 is installed in the usual place.

Your PATH variable has not been set properly, regardless of your claims.

If you simply issue this command at a command line:

export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}

and then logout and login again, the results of that command will be lost.

You’ll need to learn about environment variables and linux. You have at least 2 options:

  1. Issue this path setting command every time you need to use CUDA.

  2. Make it “permanent” by putting it in your .bashrc file or some similar approach.

Most people opt for the second approach. This involves understanding how linux environment variables work, and is not specific to CUDA.

If it’s unclear, please google. There are plenty of descriptions of how to make an environment variable setting “permanent” in linux.

Thank you so much. I just wanted help since I am new to Linux. I got it now. I will of course learn about Linux. You are proffesional and there to help us. Thank you again.