To make sense of this, start with Donato Capitella's explainer video.
To just get to a working PyTorch project, follow the steps below.
-
Follow steps here to install the latest ROCm binaries on Fedora 43: https://www.fixnum.org/2025-11-27-rocm7-fedora43/
sudo dnf install dnf-plugin-config-manager python3-setuptools python3-wheel # Uninstall existing ROCm packages sudo dnf remove rocm rocm-* # Add ROCm repositories to yum config sudo tee /etc/yum.repos.d/rocm.repo <<EOF [ROCm] name=rocm baseurl=https://repo.radeon.com/rocm/el9/latest/main/ enabled=1 priority=50 gpgcheck=1 gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key [AMDGraphics] name=rocmgraphics baseurl=https://repo.radeon.com/graphics/latest/el/9.6/main/x86_64/ enabled=1 priority=50 gpgcheck=1 gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key EOF # Install ROCm and dependencies sudo dnf install rocm rocm-developer-tools hipblas-devel hip-devel rocwmma-devel rocm-opencl-devel --allowerasing # Enable AMD's ahead-of-time Triton math library echo 'export TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1' >> ~/.bashrc # or whatever shell you use
-
Install uv: https://docs.astral.sh/uv/getting-started/installation/
-
Create a project directory and change into it, like
mkdir ~/my-project && cd ~/my-project. -
In your PyTorch project, init uv, use Python 3.13, and create a project virtual environment:
uv init --name my-project uv python install 3.13 uv venv
Make sure
.python-versionis set to3.13. -
Follow directions to install rocm and torch / torchaudio / torchvision packages, but translating the pip commands to your project's
pyproject.tomlfile:[project] name = "my-project" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ "rocm[libraries,devel]", "torch", "torchaudio", "torchvision", ] [[tool.uv.index]] url = "https://rocm.nightlies.amd.com/v2/gfx1151" [tool.uv] required-environments = [ "sys_platform == 'linux' and platform_machine == 'x86_64'", ]
-
Install the project's Python dependencies:
uv sync
-
Test the PyTorch installation following these instructions:
uv run python -c 'import torch' 2> /dev/null && echo 'Success' || echo 'Failure' uv run python -c 'import torch; print(torch.cuda.is_available())'
-
Copy-and-paste all the code from the PyTorch quickstart tutorial into a Python script and run it:
uv run python pytorch_quickstart_tutorial.py # or whatever you named the script