PyTorch via PIP installation

PyTorch via PIP installation#

AMD recommends the PIP install method to create a PyTorch environment when working with ROCm™ for machine learning development.

Note
To install the following wheels, Python 3.12 must be installed.

Prerequisites#

For the 6.4.4 PyTorch on Windows preview release, the 25.20.01.14 graphics driver must be installed.

Install PyTorch via PIP#

Enter the commands to install torch, torchvision and torchaudio for ROCm AMD GPU support.

Note
This may take several minutes. See Compatibility matrices for support information.

pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-6.4.4/torch-2.8.0a0%2Bgitfc14c65-cp312-cp312-win_amd64.whl
pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-6.4.4/torchaudio-2.6.0a0%2B1a8f621-cp312-cp312-win_amd64.whl
pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-6.4.4/torchvision-0.24.0a0%2Bc85f008-cp312-cp312-win_amd64.whl

Verify PyTorch installation#

Confirm if PyTorch is correctly installed.

  1. Verify if Pytorch is installed and detecting the GPU compute device.

    python -c "import torch" 2>nul && echo Success || echo Failure
    

    Expected result:

    Success
    
  2. Enter command to test if the GPU is available.

    python -c "import torch; print(torch.cuda.is_available())"
    

    Expected result:

    True
    
  3. Enter command to display installed GPU device name.

    python -c "import torch; print(f'device name [0]:', torch.cuda.get_device_name(0))"
    

    Example result: device name [0]: AMD Radeon Graphics

    device name [0]: <Supported AMD GPU>
    
  4. Enter command to display component information within the current PyTorch environment.

    python -m torch.utils.collect_env
    

    Example result:

    PyTorch version: 2.8.0a0+gitb3d25c8
    ROCM used to build PyTorch: 6.4.50101-9a6572ae7
    OS: Microsoft Windows 11 Pro (10.0.26100 64-bit)
    Is CUDA available: True
    GPU model and configuration: AMD Radeon Graphics
    HIP runtime version: 6.4.50101
    MIOpen runtime version: 3.4.0
    

Environment set-up is complete, and the system is ready for use with PyTorch to work with machine learning models, and algorithms.

See also: Limitations and recommended settings.