Trouble removing NVIDIA drivers
Solution 1:
List all Nvidia related packages
dpkg -l | grep nvidia
Purge all the Nvidia related package you see in the list
When you have done this successfully
sudo ubuntu-drivers autoinstall
sudo prime-select nvidia
Reboot and now your system should work fine
Solution 2:
I had similar problem. Exact steps might be different but you should get an idea from what I did.
-
uninstall nvidia drivers as mentioned above.
-
reboot and instead of login to UI, login to console
-
make sure nvidia modules are not loaded. You can do that by running command
sudo lsmod | grep nvidia
This will list any nvidia modules loaded by the kernel. If the modules are loaded that means your nvidia uninstall was not clean and you will need to manually remove the kernel module.
rmmod <name of nvidia modules>
- Install xserver-xorg
sudo apt-get install --reinstall xserver-xorg-video-nouveau
This will set your system to use nouveau.
-
Reboot and connect your monitor. It should detect now.
-
Use "Additional Drivers" from "Show Application" to install nvidia drivers. (I think latest right now is "nvidia driver metapackage from nvidia-driver-470".
Reboot.
-
Assuming you don't have secure boot enabled. If secure boot is enable you need to ensure that nvidia kernel modules are signed and loaded.
-
run
sudo lsmod | grep nvidia
andnvidia-smi
to check if nvidia drivers are loaded. -
Now run torch.cuda.is_available() and see if it is able to use GPU.