RTX 2060--nvcc is not shown in the Ubuntu Terminal but shown in the X server terminal

I have a CUDA setup problem. My nvcc is short-lived. It not permanently anchors in the Ubuntu terminal.

I successfully installed Graphics Card with the version of NVIDIA-Linux-x86_64–415.25.run. While I input the command nvidia-smi, it shows the right configuration of RTX 2060. Then I installed CUDA 10.0.130 and set Environment Variable in both the X server terminal and the Ubuntu terminal. Please see the following descriptions.

  1. Sett up environment in X server.

After switching from Ubuntu user interface to X server terminal with Ctrl+Alt+F1, I made the setup as follows.

export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64

echo ‘PATH=$PATH:/usr/local/cuda-10.0/bin’ >> ~/.bash_profile
echo ‘LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64’ >> ~/.bash_profile

After I input the command vncc -V, it shown a correct configuration in the X server terminal. It was good each time when I input nvcc -V.

  1. Set up environment variables in the Ubuntu Terminal.

However, while I switch from the X server terminal to the Ubuntu terminal by Ctrl+Alt+F7, I could not find out CUDA Compiler 10.0.130. The Ununtu Terminal shows the message as follows.

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

I had to set the following environment variables in the Ubuntu terminal every time. It worked while I was working on the terminal. However, while I opened a new Ubuntu terminal or restart my computer, I could not find out nvcc by the command nvcc -V.

sudo subl ~/.bashrc

export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64

echo ‘PATH=$PATH:/usr/local/cuda-10.0/bin’ >> ~/.bash_profile
echo ‘LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64’ >> ~/.bash_profile

source ~/.bashrc

I need to set the following commands again in order to find nvcc. However, while I opened a new Ubuntu terminal or restart my computer, I could not find out nvcc by the command nvcc -V. I had to set the above-mentioned environment variables again and again in order to find nvcc. Why the environment variables are short-lived?

Please help me solve the problem.

Thanks in advance,

Mike

If you want them to persist, you’ll need to make sure your environment variable settings are in a file that linux sources every time a new shell is opened. Normally putting them in .bashrc is sufficient.

https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-a-linux-vps

Thank you for reminding me of the bashrc. I solved the problem according to your information.

While I open the bashrc by Ctrl+H, I find out that the bashrc includes cuda-9.0.

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-9.0/bin:$PATH

After I change cuda-9.0 to cuda-10.0, I can find out the CUDA version by nvcc -V.

I export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.0/bin:$PATH

Notes:

However, it has been still quite strange since I gave the explicit commands as follows in the first letter.


export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64

However, I think that it is a version conflict. I adopted NVIDIA-Linux-x86_64–415.25.run as Graphics Driver, cuda_10.0.130_410.48_linux.run as CUDA respectively. While I installed the CUDA, I selected not to install the older Graphics Drivers suggested by the CUDA installer. But the version conflict is persisted. My commands in the terminal could not change the version info. Only direct correction in the bashrc file solved the version conflict.

Thank you again,

Mike