cuda install_error ai_generated true

AssertionError: Torch not compiled with CUDA enabled

ID: cuda/torch-not-compiled-cuda

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
12 active

Root Cause

PyTorch was installed without CUDA support (CPU-only build).

generic

Workarounds

  1. 92% success Reinstall PyTorch with the correct CUDA version from pytorch.org
    pip install torch --index-url https://download.pytorch.org/whl/cu121

    Sources: https://pytorch.org/get-started/locally/

  2. 88% success Verify installation with torch.cuda.is_available()
    python -c "import torch; print(torch.cuda.is_available())"

    Sources: https://pytorch.org/docs/stable/cuda.html#torch.cuda.is_available

Dead Ends

Common approaches that don't work:

  1. Install CUDA toolkit separately 82% fail

    PyTorch ships its own CUDA runtime, system CUDA doesn't matter

  2. Set CUDA_HOME environment variable 78% fail

    Doesn't affect already-compiled PyTorch binary

Error Chain

Leads to:
Preceded by: