0

I'm trying to install cuda in my ubuntu system. So I ran the following command:

sudo apt install nvidia-driver-535

And nvidia-smi had shown me, I have got the correct cuda version (or at least what I was looking for):

Sun Jun 30 17:42:56 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01             Driver Version: 535.183.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+

Abd then I did the following:

sudo apt update && sudo apt upgrade
sudo apt install nvidia-cuda-toolkit

But after doing all this, when I tried looking into the nvcc --version, it gives me the following:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0

Why am I getting this conflict? I want the cuda 12.2 for my nvcc as well. How can I resolve this issue? And upgrade nvcc to use cuda 12.2 as well?

3 Answers3

1

You may need to do some post-installation actions such as environment updates.

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

Then, source ~/.bashrc, you may also create symlink for your recent 12.2 by

sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-12.2 /usr/local/cuda
0

Which version of Ubuntu are you using? The conflict might be due to the Ubuntu repository having an older version of the toolkit for your Ubuntu version.

You can potentially resolve this conflict by manually installing the correct version of the package. Follow these steps:

  • Remove the current NVIDIA CUDA toolkit:sudo apt remove nvidia-cuda-toolkit && sudo apt autoremove

  • Visit Nvidia's cuda toolkit download pageand select the
    appropriate fields.

  • Finally choose your method of installation and follow the
    instructions, would suggest downloading the local runfile and
    executing it for covenience.

Blz
  • 25
0

Ubuntu 22.04

I had an old (rogue?) version of nvcc at /usr/bin. So my solution was:

cd /usr/bin
sudo mv nvcc nvcc_x
sudo ln -s /usr/local/cuda-12.2/bin/nvcc