CUDA error while installing, help to uninstall

Solution 1:

There is a conflict between the driver CUDA wants to use (nvidia-390) and the one you have installed. I had the same problem: "which is also in package nvidia-340..." For me this was solved by first purging the old nvidia driver

sudo dpkg -P nvidia-340

Only then would

sudo apt --fix-broken install

work. You can purge everything via

sudo apt purge nvidia*

sudo apt purge cuda*

You can move on to get the newer nvidia drivers

sudo apt install nvidia-390 nvidia-390-dev

Installing the nvidia-384 drivers should also work, but I'm not sure about that.