How to install Cudnn on Ubuntu WSL2?


I have encountered an issue running Tensorflow 2 on my Windows 10 (it only runs one epoch), so I am trying to install cuda and tensorflow 2 on Ubuntu via WSL2 instead.

I have followed this guide:

which is very similar to the Nvidia one here, only I have installed cuda version 11.4 instead of the latest cuda 11.7:

I am stuck if I need to install cuDNN after this and what version. Windows or Linux in my case (Installation Guide :: NVIDIA Deep Learning cuDNN Documentation)?
do I need a local installer for Ubuntu 20.04 x86_64(Deb) or a local installer for Linux x86_64 (Tar), for CUDA 11.x] of cuDNN v8.4.1 (March 27th, 2022) from Installation Guide :: NVIDIA Deep Learning cuDNN Documentation?

when I run my notebook, I get the following issue, which shows cuDNN is missing:

> physical_devices = tf.config.list_physical_devices('GPU')
> physical_devices
> 2022-06-03 18:30:28.966198: W tensorflow/stream_executor/platform/default/] Could not load dynamic library ''; dlerror: cannot open shared object file: No such file or directory
> 2022-06-03 18:30:28.966233: W tensorflow/core/common_runtime/gpu/] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at for how to download and setup the required libraries for your platform.
> Skipping registering GPU devices...

My specs:
Ubuntu 20.04 via WSL2
Windows 10 21H2
Nvidia latest driver, 512.95 compatible with GeForce RTX 3060
Cuda Driver Version/ Runtime Version 11.6/11.4( can update this to 11.7?)
Tensorflow 2.9.1
Python 3.9.7.

Please advise on how to proceed?

1 Like