PyTorch cannot find CUDA after a kernel update

I’ve got a Manjaro KDE Plasma installed on my desktop with an NVidia GPU. And I’ve been using it for some time now. Today, there was a software update and afterwards, PyTorch cannot find CUDA driver anymore.

I’ve tried reinstalling and uninstalling+installing cuda and cudnn multiple times. After each attempt, I installed a fresh new PyTorch (just in case) but nothing works.

Here are some concrete steps I’ve taken:

$ sudo pacman -S cuda cudnn
warning: cuda-12.2.0-1 is up to date -- reinstalling
warning: cudnn-8.9.2.26-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (2) cuda-12.2.0-1  cudnn-8.9.2.26-1

Total Installed Size:  6860.94 MiB
Net Upgrade Size:         0.00 MiB

:: Proceed with installation? [Y/n] y
(2/2) checking keys in keyring                                     [####################################] 100%
(2/2) checking package integrity                                   [####################################] 100%
(2/2) loading package files                                        [####################################] 100%
(2/2) checking for file conflicts                                  [####################################] 100%
(2/2) checking available disk space                                [####################################] 100%
:: Running pre-transaction hooks...
(1/1) Creating Timeshift snapshot before upgrade...
==> skipping timeshift-autosnap due skipRsyncAutosnap in /etc/timeshift-autosnap.conf set to TRUE.
:: Processing package changes...
(1/2) reinstalling cuda                                            [####################################] 100%
(2/2) reinstalling cudnn                                           [####################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Refreshing PackageKit...
$ python
Python 3.10.12 (main, Jul  5 2023, 18:54:27) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False
>>> 

Any idea what could I do next?

For anyone else who might be facing a similar issue (including future myself), the solution is to reinstall the NVidia driver.

These are the steps I’ve taken:

  1. Uninstall the cuda and cudnn packages
  2. Using the System Settings window, reinstall the NVidia driver. In my case, it was video-hybrid-intel-prime. But you might have the video-nvidia driver installed. Just right click on it and select “Reinstall”.
  3. Install the cuda and cudnn back.

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.