How to use torch with CUDA 12.9

I’m running with the following environment:

Windows 10
python 3.12.0
CUDA Version: 12.9  (according to `nvidia-smi`)
torch: 2.7.1

I did not find 12.9 at installation settings so i choose the nearest version 12.8
I’m running the following code:

import torch
print(f"Version: {torch.__version__}, GPU: {torch.cuda.is_available()}, NUM_GPU: {torch.cuda.device_count()}")

And I’m getting:

Version: 2.7.1+cpu, GPU: False, NUM_GPU: 0

What is wrong ?

Your locally installed CUDA toolkit won’t be used as PyTorch ships with its own CUDA runtime dependencies.

Based on:

You have installed the CPU-only binary and the installation log should have shown this.

Oh thanks for replying, but i just used container and feel it easier.

Tried with below which is latest as of today and it works for me.

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

nope. this works pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129

3 Likes