[Python] GPU is not available for Pytorch

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    I installed Anaconda, CUDA, and PyTorch today, and I can't access my GPU (RTX 2070) in torch. I followed all of installation steps and PyTorch works fine otherwise, but when I try to access the GPU either in shell or in script I get

    >>> import torch
    >>> torch.cuda.is_available()
    False
    >>> torch.cuda.device_count()
    0
    >>> print(torch.version.cuda)
    None


    Running conda list shows this as my installed package

    cudatoolkit 11.3.1 h59b6b97_2


    and running numba -s in the conda environment shows

    __CUDA Information__
    CUDA Device Initialized : True
    CUDA Driver Version : 11030
    CUDA Detect Output:
    Found 1 CUDA devices
    id 0 b'NVIDIA GeForce RTX 2070' [SUPPORTED]
    compute capability: 7.5
    pci device id: 0
    pci bus id: 1
    Summary:
    1/1 devices are supported


    and all of the tests pass with ok. CUDA 11.3 is one of the supported compute platforms for PyTorch and by my GPU and that is the version that I installed.

    I already tried reinstalling CUDA, I am on Windows 10, nvcc --version shows that CUDA is installed Build cuda_11.3.r11.3/compiler.29745058_0

    Any suggestions would be helpful

    Edit: I am using PyTorch 1.10 installed from the generated command on their website. Using python 3.9.7. I also installed PyTorch again in a fresh conda environment and got the same problem.

    Continue reading...

Compartilhe esta Página