cuda
install_error
ai_generated
true
AssertionError: Torch not compiled with CUDA enabled
ID: cuda/torch-not-compiled-cuda
90%Fix Rate
88%Confidence
165Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 12 | active | — | — | — |
Root Cause
PyTorch was installed without CUDA support (CPU-only build).
genericWorkarounds
-
92% success Reinstall PyTorch with the correct CUDA version from pytorch.org
pip install torch --index-url https://download.pytorch.org/whl/cu121
-
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:
-
Install CUDA toolkit separately
82% fail
PyTorch ships its own CUDA runtime, system CUDA doesn't matter
-
Set CUDA_HOME environment variable
78% fail
Doesn't affect already-compiled PyTorch binary
Error Chain
Leads to: