tensorflow device_error ai_generated true

RuntimeError: GPU device not found. Could not list physical devices: GPU

ID: tensorflow/unknown-device-gpu

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

TensorFlow does not detect any GPU. NVIDIA driver not installed, CUDA not configured, or tensorflow-cpu installed by mistake.

generic

Workarounds

  1. 92% success Install the NVIDIA driver and verify with nvidia-smi
    sudo apt install nvidia-driver-535 && nvidia-smi  # must show your GPU

    Sources: https://www.tensorflow.org/guide/gpu

  2. 90% success Install tensorflow with CUDA support, not tensorflow-cpu
    pip install tensorflow[and-cuda]  # NOT pip install tensorflow-cpu
  3. 85% success Verify GPU visibility inside Python
    print(tf.config.list_physical_devices('GPU'))  # should show your GPU; if empty, check driver/CUDA

Dead Ends

Common approaches that don't work:

  1. Install CUDA toolkit without the NVIDIA driver 85% fail

    CUDA needs a compatible NVIDIA kernel driver. The toolkit alone is not enough.

  2. Install tensorflow-gpu package (deprecated) 78% fail

    tensorflow-gpu was merged into tensorflow in TF 2.1+. The separate package is abandoned.