Error text / 报错原文
Torch not compiled with CUDA enabledCUDA is not availabletorch.cuda.is_available false
What it means
PyTorch is installed without CUDA support or the CUDA runtime cannot be detected.
Most common causes
- CPU-only torch wheel
- Driver mismatch
- Wrong virtual environment
- Unsupported GPU platform
Fastest fix
- Reproduce the smallest failing case.
- Check environment, platform, and production settings.
- Use the related local tool to classify the issue.
- Fix the highest-risk security or data issue first.
Safe fix
- Keep secrets out of client code and logs.
- Prefer least privilege and explicit allowlists.
- Add a regression test or checklist before retrying.
- Document the working production configuration.
What not to do
- Do not disable security controls as a permanent fix.
- Do not paste secrets into public issue trackers or AI chats.
- Do not trust preview success as production readiness.
Diagnostic commands
nvidia-smi python -c "import torch; print(torch.cuda.is_available())" python --version