"no kernel image is available for execution on the device"

PyTorch installed fine, but the build has no compiled code for your GPU. The fix is to install a build that does. Which one depends on your GPU generation; the tables below give the exact command.

What you see

The error itself, from CUDA (NVIDIA) or HIP (AMD), which use the same wording:

RuntimeError: CUDA error: no kernel image is available for execution on the device

Usually preceded by a PyTorch warning at import time, in one of two wordings depending on the version:

NVIDIA GeForce GTX 1080 Ti with CUDA capability sm_61 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_75 sm_80 sm_86 sm_90 sm_100 sm_120.
Found GPU0 Tesla P40 which is of compute capability (CC) 6.1.
The following list shows the CCs this version of PyTorch was built for and the hardware CCs it supports:

On AMD with ROCm 6.x and earlier, the HIP runtime also logs hipErrorNoBinaryForGpu: Unable to find code object for all current devices!; see the AMD page.

Why it happens

Every PyTorch build is compiled for a fixed list of GPU architectures. Your card runs a build when the list includes its architecture, or an older one from the same generation (code for compute capability 8.6 also runs on 8.9 cards, the rule PyTorch's own compatibility check uses). Older generations get dropped from the builds over time, and a plain pip install torch picks one specific build: from PyTorch 2.11 on, that's the CUDA 13.0 build, which starts at Turing (RTX 20-series). So a GTX 1080 Ti, P40, P100 or V100 gets a PyTorch that installs but can't run.

The fix for NVIDIA cards

The newest PyTorch that runs on each generation, and whether a plain install works:

Generation (compute capability)Cards on this siteNewest PyTorch that runsPlain pip install torch
Kepler (3.0–3.5)—none tracked heredoesn't
Kepler (3.7)K802.7.0
pip install torch==2.7.0 --index-url https://download.pytorch.org/whl/cu118
works up to 2.0.0
Maxwell (5.0–5.2)M40 24GB2.14.0
pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu126
works up to 2.7.0
Pascal (6.0–6.1)P100 SXM2 16GB, GTX 1080 Ti, Tesla P40, TITAN X (Pascal)2.14.0
pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu126
works up to 2.7.0
Volta (7.0)TITAN V, V100 SXM2 32GB2.14.0
pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu126
works up to 2.10.0
Turing (7.5)T4, TITAN RTX2.14.0
pip install torch==2.14.0
works
Ampere (8.0–8.6)A100 SXM4 80GB, RTX 3060 12GB, RTX 30902.14.0
pip install torch==2.14.0
works
Ada Lovelace (8.9)L40S, RTX 4060 Ti 16GB, RTX 4090, RTX 6000 Ada Generation2.14.0
pip install torch==2.14.0
works
Hopper (9.0)H100 SXM5 80GB, H200 SXM 141GB2.14.0
pip install torch==2.14.0
works
Blackwell (10.0–12.1)B200, B300 (Blackwell Ultra), RTX 5060 Ti 16GB, RTX 5090, RTX PRO 6000 Blackwell, DGX Spark2.14.0
pip install torch==2.14.0
works

For your exact driver and Python version, use the install checker. It also flags when your driver, rather than the GPU, is what's holding you back.

The fix for AMD cards

The same error on ROCm means the PyTorch ROCm build has no code for your card's gfx target. PyTorch 2.14.0's ROCm builds are compiled for:

Buildgfx targets
--index-url https://download.pytorch.org/whl/rocm7.2gfx900, gfx906, gfx908, gfx90a, gfx942, gfx950, gfx1030, gfx1100, gfx1101, gfx1102, gfx1103, gfx1200, gfx1201, gfx1150, gfx1151
--index-url https://download.pytorch.org/whl/rocm7.14gfx908, gfx90a, gfx942, gfx950, gfx1030, gfx1100, gfx1101, gfx1102, gfx1103, gfx1200, gfx1201, gfx1150, gfx1151

No PyTorch ROCm build from 2.6 on coversRadeon Instinct MI6 (gfx803), Radeon Instinct MI8 (gfx803), Radeon RX 6600 (gfx1032), Radeon RX 6650 XT (gfx1032), Radeon RX 6700 XT (gfx1031) or Radeon RX 6750 XT (gfx1031). For those, see the AMD page.

Check what you have

python -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.get_arch_list()); print(torch.cuda.get_device_capability())"

get_arch_list() is what the installed build was compiled for; get_device_capability() is your GPU. If no entry in the list has your GPU's major number with an equal or lower minor, you have this error.

Sources: each build's architecture list comes from PyTorch's own build scripts at each release (see PyTorch versions); error text from torch/cuda/__init__.py (PyTorch 2.14) and the CUDA and HIP runtimes.

← All error fixes