Tensorflow pip installation never finds GPUs


Hi all,
I am running Ubuntu 22.04 with a Nvidia GeForce GTX 750 Ti with compute capability of 5.0. I have installed CUDA toolkit 12.4 with proper Nvidia drivers and all samples from Nvidia which are compiled using nvcc are working find and I see that the load is transferred to GPUs successfully. Now I intend to use tensorflow that is running on GPUs. I have installed “tensorflow[and-cuda]” using pip and everything seems to be OK and installation is done successfully. Now when I execute this line of code in Python (as suggested in tensorflow to test the installation):

$ python3 -c “import tensorflow as tf; print(tf.config.list_physical_devices(‘GPU’))”

The returned list is always empty. Also I see this message whenever I include tensorflow in my Python code:

This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.

and then this message:

W tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] 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 পিপ দিয়ে টেনসরফ্লো ইনস্টল করুন  |  TensorFlow for how to download and setup the required libraries for your platform.
Skipping registering GPU devices…

My guess is that the version of tensorflow that I am installing using pip is compiler only for CPUs and not GPUs. Also, the package tensorflow-gpu is deprecated and it is said (tensorflow website) to use only tensorflow package which supports GPU.

Does anybody know what the problem could be? Any help is highly appreciated.



I googled a bit and found out that many people has experienced similar problem. I downgraded CUDA toolkit to 12.2 which is exactly the one running in Google Colab. I could not install tensoflow 2.15.0 because of lots of errors I got in pip so I still installed 2.16.1 which is the latest. I still have same problem and no GPU is detected by tensorflow. I am able to run CUDA samples and I see that the samples are offloaded to GPUs successfully so CUDA is working properly, but tensorflow by some reason cannot detect GPUs. Any hint is very appreciated!

Hi @Danesh_Daroui

Welcome to the TensorFlow Forum!

Which python version have you installed in your system. Please verify that the installed python , TensorFlow and CUDA, cuDNN version should be as per this tested build configuration. Also, check if you have followed all the step by step instructions correctly as mentioned in this TF install Official link to install TensorFlow in your system.

Please try above steps and let us know if the issue still persists. Thank you.

Hi Renu,
Thanks for your answer. No my versions do not match with this list. Can it be source of the problem? I have actually installed latest versions of CUDA toolkit which is 12.4 and cuDNN 9.0. Python on my system is 3.12.2 and tensorflow is 2.16.1. I am running Fedora 39 (latest stable) and if I want to install CUDA 12.3 then I need to install Fedora 37. Do you have a plan to support CUDA 12.4 and cuDNN 9.0 with latest versions of Python, maybe with the next release of tensorflow?

@Danesh_Daroui, Yes, That’s the reason behind the above error. TensorFlow follows specific version of CUDA and cuDNN to have GPU setup configuration in the system and you can install these libraries into Fedora 39 also.

As of now TensorFlow 2.16 is the latest TensorFlow version which supports cuDNN 8.9 and CUDA 12.3 compatible with the Python 3.9 - 3.12.

1 Like

Dear all, does somebody know, when cuda 12.4 is supported by tensorflow ?
Where can I check that info ?

Thanks a lot, Stephan

Even if you pip install tensorflow[and-cuda] you still have some additional steps to make in order to utilize your GPU. More specifically, you should appropriately configure environment variables ($LD_LIBRARY_PATH and $PATH). For more details see the respective open issue: TF 2.16.1 Fails to work with GPUs · Issue #63362 · tensorflow/tensorflow · GitHub and the respective pull request (pending review): docs/site/en/install/pip.md at patch-1 · sgkouzias/docs · GitHub