cudnn error when runnung pytorch on Google Colab
Since yesterday when I try to run Pytorch using GPU on Google Colab I recieve the error provided below. Previously it worked fine. I have tried to install different versions of Pytorch and I have got different errors.
# Use PyTorch to check versions, CUDA version and cuDNN

import torch

print(&quot;PyTorch version: &quot;)
print(torch.__version__)
print(&quot;CUDA Version: &quot;)
print(torch.version.cuda)
print(&quot;cuDNN version is: &quot;)
print(torch.backends.cudnn.version())

PyTorch version:
1.12.0+cu113
CUDA Version:
11.3
cuDNN version is:
---------------------------------------------------------------------------

RuntimeError                              Traceback (most recent call last)

&lt;ipython-input-23-93b5c974c4be&gt; in &lt;module&gt;()
      8 print(torch.version.cuda)
      9 print(&quot;cuDNN version is: &quot;)
---&gt; 10 print(torch.backends.cudnn.version())

1 frames

/usr/local/lib/python3.7/dist-packages/torch/backends/cudnn/__init__.py in version()
     48 def version():
     49     &quot;&quot;&quot;Returns the version of cuDNN&quot;&quot;&quot;
---&gt; 50     if not _init():
     51         return None
     52     return __cudnn_version
/usr/local/lib/python3.7/dist-packages/torch/backends/cudnn/__init__.py in _init()
     39                 raise RuntimeError(
     40                     'cuDNN version incompatibility: PyTorch was compiled against {} '
---&gt; 41                     'but linked against {}'.format(compile_version, runtime_version))
     42         return True
     43 else:

RuntimeError: cuDNN version incompatibility: PyTorch was compiled against (8, 3, 2) but linked against (8, 0, 5)



Use this code to upgrade Python to newer version(3.9), this solved a problem for me.
!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
!chmod +x mini.sh
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y jupyter
!conda install -q -y google-colab -c conda-forge
!python -m ipykernel install --name &quot;py39&quot; --user

