Tensorflow cannot detect GPU

This is really stressing me out. I use Anaconda environments for ML/DL stuff in Visual Studio Code, Windows 10. It was detecting GPU a couple of weeks ago, but when I need to use it now, suddenly my main neural network environment isn’t detecting my GPU (RTX 3080).

This environment has Tensorflow 2.13.0, cuDNN, and CUDA 11.2.2.

So I just spent hours creating a new environment where I made sure it matched up to the latest specs as per the Tensorflow website: tensorflow-2.15.0, python 3.9, cuDNN 8.9, and CUDA 12.2. I also tried a variation with python 3.11 (which failed), and also updated CUDA to 12.3 since the cuDNN package wanted that. None of this works.

I read somewhere in a GitHub post by TF developers that apparently any TF version less than 2.15 won’t find GPU, so I have no idea why it was working for me a few weeks ago. I read somewhere else that Windows needed a certain WSL version, so I installed that too, but I think that’s only for people who use TF through Ubuntu for whatever reasons.

So what am I doing wrong here? I have to figure this out soon.

EDIT: I just wanted to update that I figured out how to get it to work with TF v2.10. Apparently this is the last version that works with native Windows 10, but I’m sure you guys already knew that.

I still would like to know how to get TF v2.15 working though with my GPU. I couldn’t find a clear and concise explanation, even in similar threads in these forums. Every explanation I see talks about Ubuntu but I do not know much about how any of that works, nor do I have any desire to do my work through some Unix/Linux command prompt or whatever (probably not how it works but that’s my ignorant bias showing). So how does all that actually work? Do you just get the Ubuntu/WSL stuff running in the background like an MySQL virtual machine and you just proceed as usual with working in VSC?

Hi @Vovin, To work with TF2.15 with GPU you need to install wsl2 in your machine by running wsl --install in the power shell. After installation you have to open the wsl app which will be a command line interface. In the wsl terminal you have to download and install miniconda using wget and bash commands for using tensorflow in the Anaconda environment(jupyter notebook). After installing miniconda you can create new environments using conda commands and can install tensorflow using pip install tensorflow[and-conda] which will install tensorflow 2.15 and the required CUDA libraries and you can use TF2.15 with GPU. The GPU will only detect in the wsl app and will not be able to be used in the native windows if you are using TF>2.10. Thank You.

The miniconda step is something I didn’t see anything about but it sounds like that’s the ticket. So once I do that, do I ever have to touch wsl/ubuntu ever again or do I have to restart it in the background every time I turn on my PC?

So if this works then I should be able to use TF2.15 normally in windows/VSC, right?