1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

🎨 Windows + Radeon + Python + ComfyUI 環境構築ガイド

1
Last updated at Posted at 2026-02-24

💡 はじめに

AMD の ROCm が、ついに Windows 環境で利用可能となりました。

これで、CUDA 依存なしで Radeon 系の GPU を Windows で本気利用?できます。
PyTorch が 公式に AMD GPU を認識しますし、HIP を通じて CUDA 由来コードもかなり動くようです。

ComfyUI 自体が正式に ROCm に対応したため、導入の敷居もかなり低くなっています。

今回は、必要な環境や構造をいくらか把握するため、下記を参考に、ComfyUI のインストーラーを用いずに環境を構築する手順をまとめてみました。2026年2月時点の手順となります。

なお、Windows 上の ROCm nightly 前提のガイドとなります。日付ビルドで挙動変わることあるので、うまいかない場合は、組み合わせを試して確認してください。

この手順では Radeon RX 7900 XT を対象としています。Windows 版 RCom がサポートしている構成は下記を参考にしてください。

📋 前提条件

ハードウェア・OS

  • ✅ Windows 11 25H2(Build 26200以降推奨)
  • ✅ AMD Radeon RX 7900 XT(VRAM 20GB)
  • ✅ メモリ 64GB
  • ✅ 空き容量 50GB以上(モデル保存用)

ソフトウェア

  • ✅ AMD Software: Adrenalin Edition 26.1.1以降
  • ✅ Git for Windows
  • ✅ Visual Studio 2022(Professional/Community)
    • 「C++ によるデスクトップ開発」ワークロード必須
  • ✅ pymanager(Python バージョン管理)

🔧 事前準備

Step 0-1: AMD Driver 確認・更新

確認方法:

  • タスクトレイの AMD アイコン → 設定 → システム

AMD Software が Adrenalin Edition 26.1.1 未満なら更新。

  • AMD公式サイトからダウンロード
  • GPU選択: Radeon RX 7900 XT
  • 最新版 Adrenalin Edition をインストール
  • 再起動

Step 0-2: Visual Studio C++ コンポーネント確認

insightface などの Cython 拡張モジュールのビルドで必要。

Visual Studio インストール済み

  • Visual Studio Installer を起動
  • 「変更」→「ワークロード」タブ
  • 「C++ によるデスクトップ開発」にチェック
  • 「変更」をクリック

Visual Studio が無い

Build Tools for Visual Studio 2022 を入れる。


Step 0-3: Python 環境準備

今回は Python の導入とバージョン管理に pymanager を利用しました。

# pymanagerでPython 3.13をインストール
pymanager install 3.13

# インストール済みバージョン確認
pymanager list

# Python 3.13.12 が表示されればOK
Tag           Name                        Managed By  Version  Alias
3.14[-64]     Python 3.14.3               PythonCore  3.14.3   python3[-64].exe, python3.14[-64].exe
3.13[-64]     Python 3.13.12              PythonCore  3.13.12  python3.13[-64].exe

🚀 ComfyUI 環境構築

Step 1: リポジトリ取得

# 任意のディレクトリで実行(例: D:\Develop\Git\)
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI

Step 2: Python 仮想環境作成

# Python 3.13.12で仮想環境作成
py -3.13.12 -m venv venv

# 仮想環境アクティベート
.\venv\Scripts\Activate.ps1

# pipアップグレード
python -m pip install --upgrade pip

# バージョン確認
python -V
# Python 3.13.12

python -m pip -V
# pip 26.0.1 from D:\Develop\Git\ComfyUI\venv\Lib\site-packages\pip (python 3.13)

Step 3: ROCm SDK インストール(nightly)

AMD公式の ROCm nightly(gfx110X = RX 7900 XT向け)を導入する。

pip install --no-cache-dir `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm_sdk_core-7.12.0a20260207-py3-none-win_amd64.whl `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm_sdk_devel-7.12.0a20260207-py3-none-win_amd64.whl `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm_sdk_libraries_gfx110x_all-7.12.0a20260207-py3-none-win_amd64.whl `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm-7.12.0a20260207.tar.gz

Step 4: PyTorch ROCm 版インストール(動作確認済の組み合わせ)

バージョンの組み合わせが大事。確認スクリプトが動作しても ComfyUI が動作しないなどの場合もあります。

  • torch: 2.9.1(2026/02/07ビルド)
  • torchvision: 0.24.0(2026/02/07ビルド)※ 0.25.0 は ComfyUI 起動時にエラー発生
  • torchaudio: 2.9.0(2026/01/28ビルド)
# PyTorch 2.9.1 + ROCm 7.12.0
pip install --no-cache-dir `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/torch-2.9.1%2Brocm7.12.0a20260207-cp313-cp313-win_amd64.whl

# torchvision 0.24.0(0.25.0ではエラー発生する場合あり)
pip install --no-cache-dir `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/torchvision-0.24.0%2Brocm7.12.0a20260207-cp313-cp313-win_amd64.whl

# torchaudio 2.9.0(別日付ビルド)
pip install --no-cache-dir `
  https://rocm.nightlies.amd.com/v2/gfx110X-all/torchaudio-2.9.0%2Brocm7.12.0a20260128-cp313-cp313-win_amd64.whl

Step 5: PyTorch ROCm 動作確認

# import確認(PowerShell向け)
python -c "import torch" 2>$null; if ($LASTEXITCODE -eq 0) { "Success" } else { "Failure" }
# Success

# ROCmのCUDA互換レイヤー有効確認
python -c "import torch; print(torch.cuda.is_available())"
# True

# GPU認識確認
python -c "import torch; print(torch.cuda.get_device_name(0))"
# AMD Radeon RX 7900 XT

# PyTorchバージョン確認
python -c "import torch; print(torch.__version__)"
# 2.9.1+rocm7.12.0a20260207

# HIPバージョン確認
python -c "import torch; print(torch.version.hip if hasattr(torch.version, 'hip') else 'N/A')"
# 7.2.0-580ef16945

# 詳細情報
python -m torch.utils.collect_env
# PyTorch version: 2.9.1+rocm7.12.0a20260207
# Is debug build: False
# CUDA used to build PyTorch: N/A
# ROCM used to build PyTorch: 7.2.0-580ef16945
# 
# OS: Microsoft Windows 11 Pro (10.0.26200 64 ビット)
# GCC version: Could not collect
# Clang version: Could not collect
# CMake version: Could not collect
# Libc version: N/A
# 
# Python version: 3.13.12 (tags/v3.13.12:1cbe481, Feb  3 2026, 18:22:25) [MSC v.1944 64 bit (AMD64)] (64-bit runtime)
# Python platform: Windows-11-10.0.26200-SP0
# Is CUDA available: True
# ...

Step 6: ComfyUI 依存パッケージインストール

# ComfyUI本体の依存関係
pip install -r requirements.txt

# 追加パッケージ(画像処理・ユーティリティ)
pip install --no-cache-dir `
  pillow `
  opencv-python `
  scipy `
  tqdm `
  psutil `
  kornia `
  spandrel `
  safetensors `
  aiohttp `
  einops `
  transformers `
  omegaconf `
  piexif `
  pyyaml `
  accelerate

Step 7: カスタムノード用パッケージ(任意)

# 顔認識・顔入れ替え系(Reactor等で使用)
pip install --no-cache-dir insightface

# ONNX推論エンジン(CPU版 - ROCm環境ではGPU版非推奨)
pip install --no-cache-dir onnxruntime

# セグメンテーション(高度な画像処理で使用)
pip install --no-cache-dir git+https://github.com/facebookresearch/segment-anything.git

注意:

  • ROCm環境では onnxruntime(CPU版)推奨
  • onnxruntime-gpu は CUDA 専用のため基本使えない

Step 8: 環境変数設定(複数GPU環境だけ)

GPU 1台なら基本設定不要。(GPU統合型CPUを利用している場合はGPUが複数台となるため注意)

# 例: 2台構成で2台目を使う場合
$env:HIP_VISIBLE_DEVICES = "1"
$env:ROCR_VISIBLE_DEVICES = "1"

# 7900XT用(gfx1100)
$env:HSA_OVERRIDE_GFX_VERSION = "11.0.0"

echo $env:HIP_VISIBLE_DEVICES
# 1
echo $env:ROCR_VISIBLE_DEVICES
# 1

永続化するなら PowerShell プロファイルに書く:

notepad $PROFILE

追記例:

$env:HIP_VISIBLE_DEVICES = "1"
$env:ROCR_VISIBLE_DEVICES = "1"
$env:HSA_OVERRIDE_GFX_VERSION = "11.0.0"

Step 9: 詳細確認スクリプト実行

下記スクリプト (check_comfyui_rocm.py) を実行し、ROCm 環境の詳細を確認する。

r"""ComfyUI + ROCm 環境確認スクリプト

- PyTorch / ROCm(HIP) の有効性
- GPU情報(VRAM など)
- 簡易ベンチ(行列積)

使い方:
    python .\check_comfyui_rocm.py
"""

from __future__ import annotations

import platform
import sys
import time
from typing import Iterable


def _hr() -> str:
    return "=" * 60


def _gb(num_bytes: int) -> float:
    return num_bytes / (1024**3)


def _fmt_ms(seconds: float) -> str:
    return f"{seconds * 1000:.2f} ms"


def _matmul_bench(
    torch, sizes: Iterable[int], device: str
) -> list[tuple[int, float | None, str | None]]:
    results: list[tuple[int, float | None, str | None]] = []

    # fp16で軽量化(VRAM節約&速度出やすい)
    dtype = torch.float16

    for n in sizes:
        try:
            a = torch.randn((n, n), device=device, dtype=dtype)
            b = torch.randn((n, n), device=device, dtype=dtype)
            torch.cuda.synchronize()

            start = time.perf_counter()
            c = a @ b
            torch.cuda.synchronize()
            elapsed = time.perf_counter() - start

            _ = c[0, 0].item()

            del a, b, c
            torch.cuda.empty_cache()

            results.append((n, elapsed, None))
        except Exception as exc:  # noqa: BLE001 - 環境依存で色々飛ぶ
            results.append((n, None, f"{type(exc).__name__}: {exc}"))
            try:
                torch.cuda.empty_cache()
            except Exception:
                pass

    return results


def main() -> int:
    print(_hr())
    print("🎨 ComfyUI + ROCm Environment Check")
    print(_hr())
    print()

    print(f"📦 Python version: {platform.python_version()} ({sys.executable})")

    try:
        import torch  # type: ignore
    except Exception as exc:  # noqa: BLE001
        print("❌ PyTorch import failed")
        print(f"   {type(exc).__name__}: {exc}")
        return 1

    print(f"📦 PyTorch version: {torch.__version__}")
    print()

    if not bool(torch.cuda.is_available()):
        print("❌ ROCm (CUDA compatibility) is NOT available!")
        print()
        print("🔍 Troubleshooting:")
        print("   1) 環境変数 (HIP_VISIBLE_DEVICES / ROCR_VISIBLE_DEVICES) を確認")
        print("   2) torch / torchvision / torchaudio の組み合わせを再確認")
        print("   3) AMDドライバ(Adrenalin Edition)を更新")
        print("   4) ROCm SDK (nightly) の導入を再確認")
        print(_hr())
        return 2

    hip_version = torch.version.hip if hasattr(torch.version, "hip") else "N/A"
    print("✅ ROCm (CUDA compatibility) is available!")
    print(f"   HIP version: {hip_version}")

    device_count = torch.cuda.device_count()
    print(f"   Device count: {device_count}")
    print()

    for idx in range(device_count):
        props = torch.cuda.get_device_properties(idx)
        print(f"🎮 GPU [{idx}]:")
        print(f"   Name: {props.name}")
        print(f"   VRAM Total: {_gb(props.total_memory):.2f} GB")
        print(f"   Compute Capability: {props.major}.{props.minor}")
        print(f"   Multi-Processors: {props.multi_processor_count}")
        print()

    # VRAM usage (device 0)
    allocated = torch.cuda.memory_allocated(0)
    reserved = torch.cuda.memory_reserved(0)

    free_bytes: int | None = None
    total_bytes: int | None = None
    try:
        free_bytes, total_bytes = torch.cuda.mem_get_info()
    except Exception:
        pass

    print("💾 VRAM Usage:")
    print(f"   Allocated: {_gb(int(allocated)):.2f} GB")
    print(f"   Reserved:  {_gb(int(reserved)):.2f} GB")
    if free_bytes is not None and total_bytes is not None:
        print(f"   Free:      {_gb(int(free_bytes)):.2f} GB")
    print()

    # Performance test (device 0)
    print("⚡ Performance Test...")
    benches = _matmul_bench(torch, sizes=[1000, 3000, 5000, 8000], device="cuda:0")
    for n, elapsed, err in benches:
        label = f"{n}x{n} matrix multiplication".ljust(32)
        if elapsed is not None:
            print(f"   {label}: {_fmt_ms(elapsed)}")
        else:
            print(f"   {label}: skipped ({err})")

    print()
    print("✅ ComfyUI + ROCm environment is ready!")
    print(_hr())
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
python .\check_comfyui_rocm.py

期待される出力イメージ:

============================================================
🎨 ComfyUI + ROCm Environment Check
============================================================

📦 Python version: 3.13.12 (D:\Develop\Git\ComfyUI\venv\Scripts\python.exe)
Failed to get device count: no ROCm-capable device is detected (error code: 100)
📦 PyTorch version: 2.9.1+rocm7.12.0a20260207

✅ ROCm (CUDA compatibility) is available!
   HIP version: 7.2.0-580ef16945
   Device count: 1

🎮 GPU [0]:
   Name: AMD Radeon RX 7900 XT
   VRAM Total: 19.98 GB
   Compute Capability: 11.0
   Multi-Processors: 42

💾 VRAM Usage:
   Allocated: 0.00 GB
   Reserved:  0.00 GB
   Free:      19.84 GB

⚡ Performance Test...
   1000x1000 matrix multiplication : 85.05 ms
   3000x3000 matrix multiplication : 2.40 ms
   5000x5000 matrix multiplication : 5.81 ms
   8000x8000 matrix multiplication : 19.27 ms

✅ ComfyUI + ROCm environment is ready!
============================================================

Step 10: ComfyUI 起動

# 基本起動
python main.py

# オプション付き起動
python main.py --listen 0.0.0.0 --port 8188

# VRAM 20GB向け(推奨)
python main.py --highvram --preview-method auto

# 高速モード(VRAM潤沢な環境向け)
python main.py --highvram --fast

起動成功メッセージ:

To see the GUI go to: http://127.0.0.1:8188

ブラウザからアクセス:

スクリーンショット 2026-02-23 133008.png


Step 11: インストール済みパッケージ保存

PowerShell:

pip freeze > requirements_rocm.txt
cat requirements_rocm.txt

📂 最終的なディレクトリ構成(例)

ComfyUI/
├── venv/ # ROCm用仮想環境
├── models/
│   ├── checkpoints/
│   ├── vae/
│   ├── loras/
│   ├── embeddings/
│   ├── upscale_models/
│   ├── controlnet/
│   └── ...
├── custom_nodes/
├── input/
├── output/
├── main.py
├── requirements.txt
├── requirements_rocm.txt
└── check_comfyui_rocm.py

✅ 環境構築完了チェックリスト

# □ AMD Adrenalin Edition 26.1.1以降
# □ Visual Studio C++コンポーネント導入済み
# □ Python 3.13.12インストール済み
# □ ComfyUIリポジトリクローン完了
# □ venv_rocm 作成・アクティベート完了

python -V
python -c "import torch; print(torch.__version__)"
python -c "import torch; print(torch.cuda.is_available())"
python -c "import torch; print(torch.cuda.get_device_name(0))"
python -c "import torchvision; print(torchvision.__version__)"
python -c "import torchaudio; print(torchaudio.__version__)"
python -c "import torch; print(torch.version.hip if hasattr(torch.version, 'hip') else 'N/A')"
python -c "import torch; print(f'{torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB')"

python .\check_comfyui_rocm.py
python main.py --highvram

🎯 ワンライナーまとめ(コピペ用)

AMD Driver / VS C++ 導入済み前提

git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
py -3.13.12 -m venv venv
.\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip

pip install --no-cache-dir https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm_sdk_core-7.12.0a20260207-py3-none-win_amd64.whl https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm_sdk_devel-7.12.0a20260207-py3-none-win_amd64.whl https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm_sdk_libraries_gfx110x_all-7.12.0a20260207-py3-none-win_amd64.whl https://rocm.nightlies.amd.com/v2/gfx110X-all/rocm-7.12.0a20260207.tar.gz

pip install --no-cache-dir https://rocm.nightlies.amd.com/v2/gfx110X-all/torch-2.9.1%2Brocm7.12.0a20260207-cp313-cp313-win_amd64.whl https://rocm.nightlies.amd.com/v2/gfx110X-all/torchvision-0.24.0%2Brocm7.12.0a20260207-cp313-cp313-win_amd64.whl https://rocm.nightlies.amd.com/v2/gfx110X-all/torchaudio-2.9.0%2Brocm7.12.0a20260128-cp313-cp313-win_amd64.whl

pip install -r requirements.txt
pip install pillow opencv-python scipy tqdm psutil kornia spandrel safetensors aiohttp einops transformers omegaconf pyyaml accelerate
pip install insightface onnxruntime

python .\check_comfyui_rocm.py
python main.py --highvram

💡 VRAM 20GB 環境での最適化 Tips

1) モデル選択の自由度(目安)

モデル VRAM使用量 20GBで可能?
SD 1.5 (512x512) 2-3GB
SDXL (1024x1024) 6-8GB
SDXL (1536x1536) 10-12GB
Flux.1 (1024x1024) 10-14GB
Cascade (2048x2048) 15-18GB ✅ ギリギリ

2) バッチ生成

  • Batch Size: 2-4枚同時生成が現実的

3) ControlNet複数使用

  • ControlNet: 3-4個同時使用もしやすい

4) アップスケール

  1. 高解像度生成(例: 1024x1536)
  2. Hires fix(2x)→ 2048x3072
  3. Ultimate SD Upscale → 4096x6144

🚨 トラブルシューティング

問題1: GPU を認識しない

症状:

  • torch.cuda.is_available()False

対処:

# 複数GPU環境ならデバイス指定
$env:HIP_VISIBLE_DEVICES = "1"
$env:ROCR_VISIBLE_DEVICES = "1"
$env:HSA_OVERRIDE_GFX_VERSION = "11.0.0"

# Python 仮想環境に入り直す
exit
.\venv\Scripts\Activate.ps1
python -c "import torch; print(torch.cuda.is_available())"

問題2: torchvision インポートエラー

症状:

  • RuntimeError: operator torchvision::nms does not exist

対処(0.24.0に固定):

pip uninstall -y torchvision
pip install --no-cache-dir https://rocm.nightlies.amd.com/v2/gfx110X-all/torchvision-0.24.0%2Brocm7.12.0a20260207-cp313-cp313-win_amd64.whl

問題3: insightface ビルドエラー

症状:

  • error: Microsoft Visual C++ 14.0 or greater is required

対処:

  • Visual Studio Installerで「C++ によるデスクトップ開発」を追加
  • pip install insightface を再実行

問題4: ComfyUI 起動時の警告

例:

  • Failed to get device count: no ROCm-capable device is detected (error code: 100)

後続でGPU認識してれば問題ないことが多い。

例:

  • Device: cuda:0 AMD Radeon RX 7900 XT : native

この表示が出てればだいたいOK。

問題5: パフォーマンスが遅い

対処:

  • --highvram --fast で起動
  • nightly の日付を動作確認済に戻す(下の補足参照)

📊 環境情報まとめ(例)

項目 バージョン/設定
OS Windows 11 25H2
GPU AMD Radeon RX 7900 XT (20GB VRAM)
ドライバ Adrenalin Edition 26.1.1
Python 3.13.12
PyTorch 2.9.1+rocm7.12.0a20260207
torchvision 0.24.0+rocm7.12.0a20260207
torchaudio 2.9.0+rocm7.12.0a20260128
ROCm 7.12.0(nightly 2026/02/07)
HIP 7.2.0
メモリ 64GB
C++ Compiler Visual Studio 2022/2026

📋 おわりに

AMD の ROCm が、ついに Windows 環境で利用できるということで、遅ればせながら試してみました。まだ不安定感はありますが、それなりの速度で動作できているようです。

現状は「CUDA がある前提で書かれているが、ROCm でも一応動く」という状況ですが、まずは「Windows ネイティブ対応」自体が大きな分岐点になったと思いますので、nVidia との競争が盛り上がり、優位性のバランスが取れてくると良いなと思います。(小並感)

とりあえず、環境構築を確認できたので、ローカルLLMとパラメータロジックを利用したハイブリッドロールプレイチャットアプリを作ってみようと思います。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?