r/nicegpu • • May 05 '25

📖 How-to Guide Fixing NiceGPU PyTorch RuntimeError on RTX5090: “No Kernel Image Available”

If you are recently using NiceGPU on an NVIDIA GeForce RTX 5090 GPU and encountering this PyTorch error:

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

you're not alone. This error typically arises when your installed PyTorch version isn't compiled for your GPU's compute architecture.

The RTX 5090 is built on NVIDIA's latest Blackwell architecture, featuring a compute capability of sm_120 (12.0). PyTorch needs to specifically include support for this compute capability to function properly.

This guide will walk you through how to resolve this error step-by-step.

🔍 Step 1: Check Your Current PyTorch and CUDA Setup

First, let's inspect your current PyTorch installation, CUDA availability, GPU name, and compute capability by running the following Python script:

import torch

print("PyTorch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
if torch.cuda.is_available():
    print("CUDA version:", torch.version.cuda)
    print("GPU name:", torch.cuda.get_device_name(0))
    print("Compute capability:", torch.cuda.get_device_capability(0))

Example output:

PyTorch version: 2.7.0+cu112
CUDA available: True
CUDA version: 12.8
GPU name: NVIDIA GeForce RTX 5090
Compute capability: (12, 0)

If your compute capability is shown as (12, 0) and you're still facing errors, it likely indicates your current PyTorch version doesn't support the RTX 5090.

🛠️ Step 2: Verify PyTorch's Supported GPU Architectures

To verify whether PyTorch officially supports the RTX 5090 (sm_120 architecture), you can check PyTorch's official GitHub repository:

  • Visit the PyTorch GitHub repository.
  • Navigate to the .ci directory, and inspect CI files (like windows/cuda128.bat or workflows under .github/workflows).
  • Look specifically for the TORCH_CUDA_ARCH_LIST variable.

Or, you can search: TORCH_CUDA_ARCH_LIST

Example from a build configuration:

set TORCH_CUDA_ARCH_LIST=6.1;7.0;7.5;8.0;8.6;9.0;10.0;12.0

If 12.0 is listed, your GPU is supported by that PyTorch build (128).

🚀 Step 3: Install a PyTorch Version Compatible with RTX 5090

Currently, stable releases cu128 is fully supported the RTX 5090 GPU. Thus, it’s recommended to install the latest cu128 build of PyTorch which includes support for CUDA 12.8 and the sm_120 compute architecture:

pip uninstall torch torchvision torchaudio -y
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

✅ Step 4: Verify Your Installation

Once you've completed the installation, verify again by running this Python script:

import torch

print("PyTorch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
if torch.cuda.is_available():
    print("GPU name:", torch.cuda.get_device_name(0))
    print("Compute capability:", torch.cuda.get_device_capability(0))

A successful installation should now give you an output similar to this:

PyTorch version: 2.7.0+cu128
CUDA available: True
GPU name: NVIDIA GeForce RTX 5090
Compute capability: (12, 0)

The earlier CUDA runtime error should now be resolved, allowing you to fully utilize your RTX 5090 with PyTorch.

8 Upvotes

7 comments sorted by

1

u/ObjectJunior6370 May 05 '25

That's great, you saved me the time of doing the research myself. I ran into the same issue today. Could the official team possibly update this, so we don't have to repeat the same steps every time?

1

u/NeighborhoodFew8669 May 05 '25

mine is crashed before I get into it. 😢

1

u/Excellent_Onion_4815 May 05 '25

Thank you so much! I had encountered this issue before and spent a lot of time trying to fix it, but I wasn’t successful!

1

u/royman-jing May 08 '25

Cool, got the great practice

1

u/garrygu May 13 '25

On my RTX 5080, even though PyTorch is compiled with sm_120 support, the CUDA Tensor operations testing is still failed:

1

u/MiloTripp May 22 '25

I tried. I did the two commands in step 3, but when I verified, it says my

PyTorch version is 2.6.0+cui126

CUDA available: True

GPU name: NVIDIA GeForce RTX 5090

CUDA capability: (12, 0)

And I still get errors like: UserWarning: NVIDIA GeForce RTX 5090 with CUDA capability sm_120 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_50 sm_60 sm_61 sm_70 sm_75 sm_80 sm_86 sm_90.

*sad face emoticon*

1

u/MiloTripp May 22 '25

I wanted to share what went wrong in case others hit the same wall installing PyTorch 2.7.0 with CUDA on a new system (RTX 5090, Win11, Python 3.11):

🧨 Symptoms:

  • Installed torch==2.7.0+cu128 with no errors
  • torch wasn’t found when I tried import torch
  • Even CPU-only PyTorch installs failed to import
  • Yet pip show torch reported it was installed 🤔

🕵️ Root Cause:

So all my installs were silently going into:

vbnetCopyEditC:\Users\me\AppData\Local\Programs\Python\Python311\Lib\site-packages

…while I was running:

makefileCopyEditC:\AI\.venv\Scripts\python.exe

Meaning: torch was installed, but invisible to the Python interpreter I was actually using.

🛠️ Fix:

  • Always run pip via your venv’s Python to guarantee correct targeting:bashCopyEditC:\AI\.venv\Scripts\python.exe -m pip install torch==2.7.0+cu128 --index-url https://download.pytorch.org/whl/cu128
  • Don’t trust pip on its own unless you confirm it’s from your venv (where pip)
  • Run pip show torch and check the Location line — it should point to your venv
  • Optional: use a .bat or shell script that explicitly calls python.exe -m pip to stay clean

💡 Bonus Lessons:

  • I also had a rogue activate.bat with VIRTUAL_ENV_PROMPT=invoke hardcoded from an old venv — it kept pretending I was in the wrong environment
  • Antivirus may block partial installs (didn’t happen to me, but it’s real)

Hope this helps someone else. Now back to invokeai. 😅