Import tensorflow "Could not find cuda drivers on your machine, GPU will not be used"

I’m trying to understand why tensorflow can’t find cuda drivers.

python3 -c "import tensorflow"
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1777752935.272880   61002 cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
I0000 00:00:1777752935.325164   61002 cpu_feature_guard.cc:227] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE3 SSE4.1 SSE4.2 AVX AVX2 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:1777752936.999120   61002 cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.

python-tensorflow-cuda 2.21.0-1

tensorflow-cuda 2.21.0-1

tensorboard 2.20.0-3

cuda 13.2.1-1

Python 3.14.4

Arch linux with kernel 7.0.3

nvidia-smi

NVIDIA-SMI 580.142 Driver Version: 580.142 CUDA Version: 13.0

Thanks in advance for guidance on how to get this working.

Hi @Graham_Smith, Welcome to the Google AI Forum!

It seems the issue you’re seeing is caused by version incompatibility. Please refer to this official document for tested build configurations.

Thanks!

Thanks for the reply.

The latest tested version of python (3.10) is 4 years old. Is there a reason it can not find cuda drivers with python 3.14?

TensorFlow 2.21 officially supports Python versions 3.10 to 3.13. Try using python 3.12 or Python 3.13 versions, which is compatible with TensorFlow 2.21.