Nvidia-cuda-toolkit and nvidia driver version

i have GeForce 9600M GT and default driver is nvidia-340 and it works well i have ubuntu20.
However, the problem begins when I want to install the “nvidia-cuda-toolkit” package to utilize CUDA tools. The installer wants to remove nvidia-340 and to install the newest nvidia driver.
I loose my graphic driver and cuda tools

Can you please help in installing the both … i am interested in cuda development ?

The GeForce 9600M GT is approximately 12 years old, and uses the Tesla architecture (compute capability 1.1, I think). Best I can tell, the last CUDA version that supported GPUs with compute capability 1.1 was CUDA 6.5 from late 2014. Driver 340.xx appears to be the matching driver version for that.

You can retrieve old CUDA versions from NVIDIA’s archive (https://developer.nvidia.com/cuda-toolkit-archive). No idea whether it will work with your modern version of Ubuntu. I consider it unlikely. CUDA 6.5 + Ubuntu 20 is certainly an unsupported combination and you will be on your own if you encounter problems.

I would strongly recommend acquiring modern GPU hardware if you want to give CUDA a try. Even a cheap low-end model of today provides much more capability than that ancient GeForce 9600M GT.