Skip to content

TF 2.21.0 doesn't find GPU, but 2.20.0 does #113541

@thephet

Description

@thephet

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

binary

TensorFlow version

2.21.0

Custom code

No

OS platform and distribution

Arch Linux (fully updated)

Mobile device

No response

Python version

3.13

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

12.9 / 9.20 (automatically installed with pip)

GPU model and memory

RTX 2070 Super and RTX 4090

Current behavior?

Arch Linux fully updated. When installing Tensorflow 2.20 it all works fine, but 2.21 doesn't detect GPU. Tensorflow installed using pip. Please see below a log.

Same issue happens in 2 different computers with two different GPUs. Pip install without saying the version installed 2.21. I also tested it with nightly, same issue.

Standalone code to reproduce the issue

conda create -n myenv python=3.13
conda activate myenv
pip install 'tensorflow[and-cuda]'
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

pip install 'tensorflow[and-cuda]==2.20'
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

Relevant log output

FIRST THE OUTPUT FOR 2.21
(myenv) [juanma@RScomp ~]$ python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1774864652.884673   70816 port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
I0000 00:00:1774864652.906580   70816 cpu_feature_guard.cc:227] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1774864653.421086   70816 port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
W0000 00:00:1774864653.546148   70816 gpu_device.cc:2365] 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 https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
[]

NOW THE OUTPUT FOR 2.20
(myenv) [juanma@RScomp ~]$ python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
2026-03-30 10:59:31.532594: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2026-03-30 10:59:31.554544: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2026-03-30 10:59:32.059641: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions