Setting up your environment this way avoids most errors on this page.
| Practice | What happens if you skip it |
|---|---|
| Install the CUDA build using the command generated on the PyTorch website instead of a bare pip install torch. | On Windows you get the CPU build and torch.cuda.is_available() returns False. |
| For training models you do not need a separate CUDA Toolkit, because PyTorch packages bundle the CUDA runtime. | An extra CUDA and cuDNN install muddles environment variables and DLL search paths, so errors are harder to trace. |
| Run nvidia-smi to see the highest CUDA version your driver supports, then pick a PyTorch CUDA build no newer than that. | With a driver that is too old, PyTorch finds no usable GPU. |
| On Windows, install the Microsoft Visual C++ Redistributable before PyTorch. | import torch fails with WinError 126 when loading fbgemm.dll or similar files. |
| Create a separate conda or venv environment per project. | torch and torchvision versions from different projects overwrite each other and stop matching. |
Troubleshooting by error message
Find your exact error message. Each entry gives the cause, the fix, and what may come up after the fix.
torch.cuda.is_available() returns False
Cause: Most often the CPU build of PyTorch is installed; otherwise the GPU driver is too old, or the driver was updated without a restart.
Fix: Run print(torch.version.cuda); None means the CPU build, so reinstall the CUDA build with the official command. If it prints a version, update the driver and restart.
What may come next: Reinstall torchvision and torchaudio for the same CUDA build, or import fails with a version mismatch.
AssertionError: Torch not compiled with CUDA enabled
Cause: The PyTorch in this environment is the CPU build, but the code calls .cuda() or device="cuda".
Fix: Uninstall torch and reinstall it with the command the PyTorch website generates for your CUDA version.
What may come next: Other packages that depend on torch may make pip pull the CPU build back in, so check torch.version.cuda again afterwards.
RuntimeError: CUDA error: no CUDA-capable device is detected
Cause: No usable NVIDIA GPU is visible: the driver is broken, or the GPU was not passed into the VM or container.
Fix: Run nvidia-smi first; if no GPU shows up, reinstall the driver. In a container, start it with --gpus all.
RuntimeError: CUDA error: unspecified launch failure (after suspend)
Cause: After suspend and resume on Linux, the NVIDIA nvidia_uvm kernel module is in a bad state.
Fix: Run sudo rmmod nvidia_uvm and then sudo modprobe nvidia_uvm, or restart the computer.
What may come next: It can happen after every suspend, so turn off automatic sleep before long training runs.
OSError: [WinError 126] The specified module could not be found. Error loading "...\torch\lib\fbgemm.dll" or one of its dependencies.
Cause: Windows is missing the Visual C++ runtime that fbgemm.dll depends on (for example libomp140.x86_64.dll).
Fix: Install the latest Microsoft Visual C++ Redistributable (x64), open a new terminal and import torch again.
What may come next: If another DLL fails to load after that, several Pythons or CUDA installs on the same machine are usually competing for the DLL path.
OSError: [WinError 126] ... Error loading "...\torch\lib\shm.dll" or one of its dependencies.
Cause: A known PyTorch 2.3.0 issue: with Python installed system-wide and torch installed per user, the DLL is not found.
Fix: Upgrade to 2.3.1 or later.
OSError: [WinError 126] (Python 3.7 from the Microsoft Store)
Cause: The old Microsoft Store Python does not support the way PyTorch loads its DLLs.
Fix: Use Python 3.8 or later from python.org, or use conda.
What may come next: After switching Python, every package you installed before must be reinstalled in the new environment.
OSError: [WinError 1114] A dynamic link library (DLL) initialization routine failed. Error loading "...\torch\lib\c10.dll" or one of its dependencies.
Cause: PyQt6 or another library with its own DLLs was imported before torch, and their DLLs conflict.
Fix: Import torch before other libraries; if it still fails, test in a fresh environment with only PyTorch.
What may come next: These DLL conflicts have no universal fix and often mean checking the other packages one by one.
NVIDIA Installer failed (while installing the CUDA Toolkit)
Cause: Often Windows Update started during the install, or no supported Visual Studio is installed.
Fix: Pause Windows Update and install again; install a supported Visual Studio first if you need to compile CUDA code.
What may come next: From CUDA 13.1 the Windows Toolkit no longer bundles the GPU driver, so install the driver separately.
cuDNN is installed, but PyTorch still reports a different version
Cause: PyTorch uses the cuDNN bundled in its package and ignores a separately installed cuDNN.
Fix: Training PyTorch models does not need a separate cuDNN; if other programs need it, pip install nvidia-cudnn-cu12 or nvidia-cudnn-cu13 to match the CUDA major version.
What may come next: cuDNN 9 can only be installed for one CUDA version at a time, so remove the old package when you switch CUDA versions.
Scientify is a cloud computer with research software installed and AI agents such as Codex and Claude Code built in. Describe what you need in one sentence, for example "train a ResNet classifier on this image dataset and report test accuracy", and the agent uses the preinstalled PyTorch to do the modeling and computation, with no software to install and no code to write.
Compared with installing more on your own computer, the cloud computer already has PyTorch 2.14.1, and the callable GPU machines come with PyTorch 2.14 for CUDA 13 and JAX, with drivers set up on everything from T4 to Blackwell GPUs, so there are no versions to match, and runs continue after you close your laptop.
The cloud computer comes with more computing power: CPU and GPU clusters can be called on demand for large-scale scientific computing. Compute is billed by the minutes you actually use, so nothing is wasted.
- Cloud computer
- 4 vCPU · 8 GB
- Top configuration, for data processing and small to medium jobs
- Callable GPU
- 96 GB VRAM
- Up to an RTX PRO 6000 per GPU; H800 80 GB and up to 8 × A10G also available
- Callable CPU
- 224 cores · 3 TB
- Largest spec, for large parallel computations
References
- PyTorch Get Started — Generates the install command per OS and CUDA version
- PyTorch Forums: cuda.is_available() returns False — CPU builds, driver versions and restarting
- PyTorch Forums: unspecified launch failure after suspend — Reloading nvidia_uvm
- PyTorch Forums: WinError 126 for fbgemm.dll — Installing the Visual C++ Redistributable
- PyTorch issue #125109 — The shm.dll issue in 2.3.0, fixed in 2.3.1
- PyTorch Forums: WinError 1114 for c10.dll — Import order and PyQt6
- NVIDIA CUDA Installation Guide for Windows — Visual Studio requirements; the driver is no longer bundled
- NVIDIA cuDNN installation — pip package names and the one-CUDA-version limit
- NVIDIA Brev: GPU detection in PyTorch — Troubleshooting no CUDA-capable device