Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

Installing PyTorch with ROCm Acceleration on Ubuntu 24.04 (ROCm 7.2.1, 2026 Setup)

A version-matched guide to installing PyTorch with ROCm on Ubuntu 24.04: hardware and kernel checks, pip versus Docker, the ROCm 7.2.1 wheel set, and GPU verification.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run PyTorch on an AMD GPU under Ubuntu 24.04, create a Python 3.12 virtual environment and install the ROCm 7.2.1 wheel set that AMD’s ROCm on Radeon and Ryzen installation page lists for that platform: PyTorch 2.9.1, torchvision 0.24.0, torchaudio 2.9.0 and Triton 3.5.1. AMD also documents a prebuilt ROCm PyTorch container for the same Ubuntu release. Whichever route you take, finish by confirming that PyTorch can detect the GPU, not just that the import succeeds. The version details below reflect AMD’s documentation as of early October 2026. AMD changes wheel names and supported combinations over time, so check its live page before you start.

Check hardware, Python and kernel requirements first

Most failed installs trace back to one of three mismatches. Confirm all three before downloading anything.

As an Amazon Associate I earn from qualifying purchases.

  • GPU and APU support. ROCm support depends on the exact GPU or APU, operating system, ROCm version and PyTorch build. AMD points readers to its compatibility matrices rather than publishing a complete model list on the installation page, so an AMD graphics card is not automatically a supported one. Check your exact hardware against the matrix for ROCm 7.2.1.
  • Python version. The Ubuntu 24.04 examples on AMD’s page use Python 3.12 and CPython 3.12 (cp312) wheel files. Run python3 --version and confirm it reports 3.12.x.
  • Kernel on Ryzen systems. AMD states that PyTorch on Ryzen requires the 6.14-1018 OEM kernel or newer. That requirement is written for Ryzen. Do not treat it as a universal prerequisite for every Radeon desktop GPU.

Ryzen kernel check

If your system is Ryzen-based and uname -r reports an older kernel, AMD’s documented fix is the Ubuntu OEM kernel package:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Run sudo apt update && sudo apt install linux-oem-24.04.
  2. Reboot the machine.
  3. Run uname -r and confirm the version is 6.14-1018 or newer.

Choose pip or Docker

AMD recommends pip for building a ROCm PyTorch environment for machine-learning work and presents the prebuilt container as an alternative. The table compares the two routes.

#1 Best Overall
ASUS Dual Radeon RX 9060 XT 16GB GDDR6 Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1a, 2.5-slot design, Axial-tech Fans, 0dB Technology
  • Axial-tech fans now feature a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • 2.5-slot design allows for greater build compatibility while maintaining cooling performance
  • 0dB technology lets you enjoy light gaming in relative silence
  • Dual BIOS switch lets you toggle between Quiet and Performance BIOS profiles
  • Dual ball fan bearings last up to twice as long as sleeve bearing designs
Factor Pip wheels in a virtual environment Prebuilt ROCm PyTorch container
AMD’s position Recommended method Documented alternative
What you control Exact wheel set; you must match Python 3.12 and ROCm 7.2.1 yourself Versions are fixed by the image tag
Isolation Packages stay in your venv, away from Ubuntu’s system Python The whole stack, including Python, lives in the container
Host GPU access Direct, through the normal host driver setup Requires passing /dev/kfd and /dev/dri and adding the video group
Extra software needed Python venv tooling Docker Engine
Reproducibility Good if you pin the same four wheel files Strong, because the image tag identifies the stack

Install with pip

Create the environment

  1. Confirm the interpreter: python3 --version should show 3.12.x.
  2. If the venv module is missing, install it with sudo apt install python3-venv.
  3. Create and activate the environment: python3 -m venv ~/rocm-pytorch followed by source ~/rocm-pytorch/bin/activate.
  4. Upgrade pip inside the environment: python -m pip install --upgrade pip.

AMD notes that pip may need the --break-system-packages flag when Python 3.12 is used outside a virtual environment. Avoid that flag by using the venv. Installing into Ubuntu’s managed Python environment can conflict with system packages.

Install the ROCm 7.2.1 wheel set

  1. Open AMD’s ROCm on Radeon and Ryzen installation page and find the Ubuntu 24.04 section with Python 3.12 wheels. Copy the current wheel locations from that page. Do not reuse wheel URLs from older guides.
  2. Remove any existing copies so the ROCm builds are not mixed with other PyTorch builds: pip uninstall -y torch torchvision torchaudio triton.
  3. Install the four downloaded files in a single pip install command so pip resolves them as one set.

The set AMD lists for Ubuntu 24.04 at the time of writing is:

Rank #2
Sale
ASUS Prime Radeon RX 9070 XT 16GB GDDR6 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI/DP 2.1, 2.5-slot, Axial-tech Fans, Dual-ball Fan Bearings, dual BIOS, ASUS GPU Guard
  • Axial-tech fans now feature a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • Phase-change GPU thermal pad helps ensure optimal heat transfer, lowering GPU temperatures for enhanced performance and reliability
  • 2.5-slot design allows for greater build compatibility while maintaining cooling performance
  • Dual-ball fan bearings last up to twice as long as standard conventional sleeve bearings designs
  • 0dB technology lets you enjoy light gaming in relative silence
Package Version ROCm build Python tag
torch (PyTorch) 2.9.1 ROCm 7.2.1 cp312
torchvision 0.24.0 ROCm 7.2.1 cp312
torchaudio 2.9.0 ROCm 7.2.1 cp312
triton 3.5.1 ROCm 7.2.1 cp312

AMD’s versioned ROCm 7.2 page lists a separate 7.2.0 wheel set. Do not mix its files with the 7.2.1 set. If you already have 7.2.0 packages installed, uninstall them before following the steps above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

AMD recommends its own wheels from its Radeon repository. It also states that it does not extensively test PyTorch Foundation wheels, and that nightly builds change regularly. For a reproducible ROCm environment, stay with AMD’s repository.

Rank #3
ASRock Radeon RX 7600 Challenger Pro 8GB OC, AMD RDNA 3, 8GB GDDR6, PCIe 4.0, Triple Fans, 0dB Silent, 2695MHz Boost, Triple Fan Graphics Card
  • System Compatibility Note: 2.5‑slot card measuring 303 mm (L) x 131 mm (W) x 45 mm (H); requires a single 8‑pin power connector and a recommended 550W power supply. Please verify chassis clearance and power supply capacity before purchase.
  • Dedicated Support: Please contact us directly through Amazon for any product questions or assistance you may require.
  • AMD RDNA 3 Architecture with AI & Ray Tracing Acceleration: Powered by 32 RDNA 3 Compute Units featuring 3rd Gen Ray Tracing Accelerators and 2nd Gen AI Accelerators, delivering lifelike lighting, shadows, and superior machine learning performance for enhanced gaming and content creation.
  • Powerful 1080p & 1440p Gaming Engine: Features a max boost clock of up to 2695 MHz, a game clock of 2280 MHz, and 2048 stream processors, ensuring outstanding frame rates in the latest titles.
  • 8GB High‑Speed GDDR6 Memory: Equipped with 8GB of GDDR6 memory on a 128‑bit interface running at 18 Gbps, delivering up to 288 GB/s bandwidth for high‑resolution textures and demanding game workloads.

Install with Docker

  1. Install Docker Engine and confirm your user can run Docker commands.
  2. Pull the Ubuntu 24.04 image: docker pull rocm/pytorch:rocm7.2_ubuntu24.04_py3.12_pytorch_release_2.9.1. Check AMD’s documentation for the current tag before pulling, because tags are updated.
  3. Start the container with the host GPU devices passed through:
docker run -it --device=/dev/kfd --device=/dev/dri --group-add video --ipc=host --shm-size [size from AMD's example] rocm/pytorch:rocm7.2_ubuntu24.04_py3.12_pytorch_release_2.9.1

The --device flags expose the host’s GPU device nodes to the container, --group-add video gives the container user access to them, and --ipc=host enables host IPC as in AMD’s example. Use the shared-memory value shown in AMD’s example. If a container start fails, check that /dev/kfd and /dev/dri exist on the host before changing anything else.

Do not combine this image with packages from the separately versioned ROCm 7.2 wheel set. The container already contains its own PyTorch stack.

Rank #4
Sale
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
  • Powered by Radeon RX 9070 XT
  • WINDFORCE Cooling System
  • Hawk Fan
  • Server-grade Thermal Conductive Gel
  • RGB Lighting
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify that PyTorch can use the GPU

Run these checks inside the activated venv or inside the container. AMD’s expected results are shown after each command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Import check. Command: python3 -c 'import torch' 2> /dev/null && echo 'Success' || echo 'Failure'. Expected output: Success.
  2. Availability check. Command: python3 -c 'import torch; print(torch.cuda.is_available())'. Expected output: True. On ROCm builds, PyTorch uses the torch.cuda API as the generic GPU interface, so this check is correct even though the name refers to CUDA.
  3. Device name. Command: python3 -c "import torch; print(f'device name [0]:', torch.cuda.get_device_name(0))". Expected output: a device name [0]: line followed by your GPU’s name. AMD’s current page shows “AMD Radeon Graphics” as an example, and its versioned ROCm 7.2 guide shows “Radeon RX 7900 XTX”. These names are illustrative, not a compatibility list.
  4. Environment report. Command: python3 -m torch.utils.collect_env. It reports the PyTorch and ROCm build, OS, GPU configuration, HIP runtime and MIOpen runtime. Save this output whenever you need to troubleshoot or report a problem.

Troubleshooting

The import check prints Failure

  • Confirm the environment is active. which python3 should point inside ~/rocm-pytorch.
  • Confirm the interpreter is Python 3.12, since the wheels are cp312 builds.
  • Reinstall all four packages from the same AMD page so they come from one wheel set.

Availability prints False

  • Check the GPU and OS against AMD’s compatibility matrix for ROCm 7.2.1. The page does not list every model, so an unlisted card may need a different supported configuration.
  • Check that the wheel set matches ROCm 7.2.1 and does not mix in 7.2.0 files.
  • On Ryzen, run uname -r and confirm the kernel is 6.14-1018 OEM or newer.
  • In Docker, confirm the --device and --group-add video flags were included in the run command. Then run collect_env inside the container and compare its output with the host.

The Docker container cannot see the GPU

  • Confirm /dev/kfd and /dev/dri exist on the host.
  • Restart the container with the full device and group flags shown above.

Packages from different ROCm releases are installed

  • Uninstall torch, torchvision, torchaudio and triton from the environment.
  • Reinstall the complete 7.2.1 set from AMD’s current page, then rerun the verification checks.

If the problem remains after these checks, save the collect_env output and compare the GPU, ROCm, Python and kernel details against AMD’s current documentation.

Quick Recap

Bestseller No. 1
ASUS Dual Radeon RX 9060 XT 16GB GDDR6 Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1a, 2.5-slot design, Axial-tech Fans, 0dB Technology
ASUS Dual Radeon RX 9060 XT 16GB GDDR6 Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1a, 2.5-slot design, Axial-tech Fans, 0dB Technology
0dB technology lets you enjoy light gaming in relative silence; Dual BIOS switch lets you toggle between Quiet and Performance BIOS profiles
$529.00
SaleBestseller No. 2
ASUS Prime Radeon RX 9070 XT 16GB GDDR6 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI/DP 2.1, 2.5-slot, Axial-tech Fans, Dual-ball Fan Bearings, dual BIOS, ASUS GPU Guard
ASUS Prime Radeon RX 9070 XT 16GB GDDR6 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI/DP 2.1, 2.5-slot, Axial-tech Fans, Dual-ball Fan Bearings, dual BIOS, ASUS GPU Guard
0dB technology lets you enjoy light gaming in relative silence; Dual BIOS switch lets you toggle between Quiet and Performance BIOS profiles
$831.99
SaleBestseller No. 4
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
Powered by Radeon RX 9070 XT; WINDFORCE Cooling System; Hawk Fan; Server-grade Thermal Conductive Gel
$814.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.