Does anyone actually know how to get Tensorflow to detect GPU?

For the past few days I’ve been scouring the internet for a helpful tutorial that isn’t >1 year old that uses WSL2 to help tensorflow access the GPU. I’ve followed the instructions here but have had no luck. I run on Windows 11 and have an RTX 3060 Ti.

Hi @tbananas, Could you please run the !nvidia-smi command and share the output. Thank You.

Hi @tbananas, In my windows 11 machine i have tried to install tesorflow with gpu using

python3 -m pip install tensorflow[and-cuda]

and i did not face any errors.


Thank You.

@Kiran_Sai_Ramineni How did you implement the section of the command [ and -cuda]?

I used the below lines under Linux and conda, but suspect I should not have specified the cuda and cudnn versions explicitly:

conda install -c conda-forge cudatoolkit=11.8.0

python3 -m pip install nvidia-cudnn-cu11==8.6.0.163 tensorflow==2.13.0 tensorflow-datasets==4.9.2

EDIT: Spelling

Hi @brendonwp, If you specify [and - cuda] with pip install like pip install tensorflow[and -cuda] the cuda, cuddn packages required for tensorflow 2.15 will be automatically downloaded and you don’t need to install them separately. If you want to use lower versions than 2.15 with GPU pip install tensorflow[and -cuda] won’t work, you have to install tensorflow and need to install cuda, cudnn packages separately. Thank You.

1 Like

Hi @Kiran_Sai_Ramineni, thanks that’s what I needed to know. I’m trying to configure v 2.13 for the tensorflow practitioner certificate. I have a separate post on this since tensorflow recognises the GPU and completes test operations fine. But fails on every network I try it on.