Cannot install cuda to ubuntu 21.04

nvidia driver installed

nvidia-smi gives

 NVIDIA-SMI 465.27       Driver Version: 465.27       CUDA Version: 11.3     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0  On |                  N/A |
| 31%   33C    P8    38W / 430W |    521MiB / 24243MiB |      0%      Default |
|                               |                      |                  N/A |


sudo apt install nvidia-cuda-toolkit

but it removes the nvidia driver 465 and installs 460 with

The following additional packages will be installed:
  libnvidia-compute-460 libnvidia-ml-dev nvidia-cuda-dev
Recommended packages:
The following packages will be REMOVED:
  libnvidia-compute-465 libnvidia-compute-465:i386 libnvidia-decode-465
  libnvidia-decode-465:i386 libnvidia-encode-465 libnvidia-encode-465:i386
  nvidia-compute-utils-465 nvidia-driver-465 nvidia-utils-465
The following NEW packages will be installed:
  libnvidia-compute-460 libnvidia-ml-dev nvidia-cuda-dev nvidia-cuda-toolkit


nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0

but the nvidia driver is mia

bash: /usr/bin/nvidia-smi: No such file or directory

obviously cuda requires the nvidia drivers so how do i fix this??

I think sudo apt install nvidia-cuda-toolkit would install cuda toolkit 10.2 and nvidia driver 460 no matter what you have currently installed. You can try with installing specific version of cuda toolkit like: sudo apt install cuda-toolkit-11-1.

But after installing a specific version, the nvcc would have to be added to PATH explicitly.
Hope it helps :)

I also have the same problem, I cannot use cuda toolkit and neither can Nvidia Docker

I just made it! Install Nvidia driver 460, and cuda 11.2. They can match each other successfully!