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. Runpython3 --versionand 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.
- Run
sudo apt update && sudo apt install linux-oem-24.04. - Reboot the machine.
- Run
uname -rand 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
- 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
- Confirm the interpreter:
python3 --versionshould show 3.12.x. - If the venv module is missing, install it with
sudo apt install python3-venv. - Create and activate the environment:
python3 -m venv ~/rocm-pytorchfollowed bysource ~/rocm-pytorch/bin/activate. - 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
- 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.
- Remove any existing copies so the ROCm builds are not mixed with other PyTorch builds:
pip uninstall -y torch torchvision torchaudio triton. - Install the four downloaded files in a single
pip installcommand so pip resolves them as one set.
The set AMD lists for Ubuntu 24.04 at the time of writing is:
Rank #2
- 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.
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
- 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
- Install Docker Engine and confirm your user can run Docker commands.
- 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. - 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
- Powered by Radeon RX 9070 XT
- WINDFORCE Cooling System
- Hawk Fan
- Server-grade Thermal Conductive Gel
- RGB Lighting
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.
- Import check. Command:
python3 -c 'import torch' 2> /dev/null && echo 'Success' || echo 'Failure'. Expected output:Success. - Availability check. Command:
python3 -c 'import torch; print(torch.cuda.is_available())'. Expected output:True. On ROCm builds, PyTorch uses thetorch.cudaAPI as the generic GPU interface, so this check is correct even though the name refers to CUDA. - Device name. Command:
python3 -c "import torch; print(f'device name [0]:', torch.cuda.get_device_name(0))". Expected output: adevice 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. - 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 python3should point inside~/rocm-pytorch. - Confirm the interpreter is Python 3.12, since the wheels are
cp312builds. - 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 -rand confirm the kernel is 6.14-1018 OEM or newer. - In Docker, confirm the
--deviceand--group-add videoflags were included in the run command. Then runcollect_envinside the container and compare its output with the host.
The Docker container cannot see the GPU
- Confirm
/dev/kfdand/dev/driexist 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,torchaudioandtritonfrom 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
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.




