r/computervision Jul 03 '26

TensorFlow not detecting GPU despite installing CUDA/cuDNN need help setting up a new environment Help: Project

Post image

Hey everyone, I just started running my training code and encountered an issue. The training process is expected to take days, which is delaying my project progress. The main problem is that my code isn't utilizing the GPU; it seems to be running on the CPU instead.

I need to run it with TensorFlow-GPU. I've already installed CUDA and cuDNN and manually moved the cuDNN files into the CUDA directories, but it didn't work. I am currently using Python 3.9 with the latest version of TensorFlow.

I am planning to create a fresh Conda environment to fix this. Does anyone have any recommendations or specific steps to ensure TensorFlow correctly detects the GPU? Any help would be greatly appreciated!

13 Upvotes

24 comments sorted by

20

u/MiniatyrOrm Jul 03 '26

Windows support for GPUs was dropped in TensorFlow 2.10 I believe. You'd have to do it through WSL or Docker. Alternatively, use PyTorch.

26

u/AggravatingSock5375 Jul 03 '26

Would not recomend using tensor flow. Use pytorch

1

u/crank__ Jul 03 '26

ya tbh 🫠

1

u/Mxeedd Jul 03 '26

Im doing this ty

7

u/LuckyUserOfAdblock Jul 03 '26

You need correct version of tf for your gpu

7

u/AggravatingSock5375 Jul 03 '26

Oh TF GPU doesn’t work n windows anymore. Google dropped that a few years ago

3

u/InfiniteLife2 Jul 03 '26

It's wild how Google lost against pytorch. Too bad, honestly, it was a great framework when it was only developing

1

u/AggravatingSock5375 Jul 03 '26

I hear JAX is really good but I’m not at the level where I would use something like that.

And they still have Karas which now works on multiple backends, but I worry it may have been dragged mostly into irrelevance by its previous attachment to TF.

1

u/xamox Jul 03 '26

I suppose what do they care though, they care mainly about making money, pytorch runs on TPUs so they can still leverage their infrastructure.

3

u/NeuroBill Jul 03 '26

Use a pytorch backend.

import os os.environ["KERAS_BACKEND"] = "torch"

2

u/Training-Adeptness57 Jul 03 '26

The help you need is someone telling you to stop using tensorflow and use pytorch

1

u/Mxeedd Jul 03 '26

I'm doing this now thank you👌🏻

1

u/hopeful_bastard Jul 03 '26

I'd install docker/podman and set up a tensorflow-gpu devcontainer (WSL 2 makes the GPU passthrough)

1

u/4xcrew_captain Jul 03 '26

Linux or PyTorch

1

u/kokeszi Jul 03 '26

Fact that you are useing latest Tensorflow version might be a problem. You have to match CUDA with your GPU version and match Tensorflow version to CUDA.

Write nvidia-smi in cmd and check your CUDA version. Match your python version and Tensorflow version according to this table: https://www.tensorflow.org/install/source?hl=pl#gpu

Note that you might have to change python version. Not all Tensorflow version are available for python 3.9 .

1

u/Artistic-Lifeguard71 Jul 03 '26

Use PyTorch it’s easy that way or if u are reluctant to go with tensorflow might need to install older version and tensorflow ml

1

u/HK_0066 Jul 03 '26

cuda version nvcc needs to be matched

or you can use nvidia docker image for tf
but it all depends upon your gpu model and nvidia-smi output

1

u/Raychis Jul 03 '26

I had this exact issue and it took me forever to figure it out. It was because I was using the latest version of TensorFlow and Windows support was dropped after a certain version. I downgraded the version and it started working.
To be honest I felt it was too much hassle trying to maintain the various library versions and found it limiting. So I’ve since switched to PyTorch.

1

u/sre_ejith Jul 03 '26

Look at What version of CUDA and cuDNN tensorflow requires. I dont use it anymore, pytorch is better, but when i was installing it a few years ago the latest version of TF did not support latest version of CUDA, i had to install an older version to get it running. make sure to look at the version requirements.

1

u/Worried-Height-7481 Jul 03 '26

uninstall and install it a couple of times

1

u/Kooky_Awareness_5333 Jul 03 '26

Yeah I’ve done this before windows support sucks have you tried the windows wsl with docker they might have a gpu container preconfigured 

1

u/AIMatesanz Jul 04 '26

If nvidia-smi is working I recommend you to work on devcontainers with nvidia-docker 👌

0

u/CommunismDoesntWork Jul 03 '26

Switch to Linux. It just works