SOLVED: PyTorch 2.7.1+XPU Intel Arc Graphics Complete Setup Guide (Linux)"

username: Innomen
cooked: <p>Went down a bit of an AI tech support rabbit hole. 10 hours later I thought I’d share the bottom. This is a low effort AI post. Just hoping it saves people some time. This will likely be a drive by XD</p>
<h1><a name="p-471818-solved-pytorch-271xpu-on-intel-arc-graphics-complete-setup-guide-1" class="anchor" href="#p-471818-solved-pytorch-271xpu-on-intel-arc-graphics-complete-setup-guide-1"></a><img src="https://discuss.pytorch.org/images/emoji/apple/white_check_mark.png?v=14" title=":white_check_mark:" class="emoji" alt=":white_check_mark:" loading="lazy" width="20" height="20"> SOLVED: PyTorch 2.7.1+XPU on Intel Arc Graphics - Complete Setup Guide</h1>
<h2><a name="p-471818-success-pytorch-xpu-working-on-intel-arc-graphics-2" class="anchor" href="#p-471818-success-pytorch-xpu-working-on-intel-arc-graphics-2"></a><img src="https://discuss.pytorch.org/images/emoji/apple/tada.png?v=14" title=":tada:" class="emoji" alt=":tada:" loading="lazy" width="20" height="20"> SUCCESS! PyTorch XPU Working on Intel Arc Graphics</h2>
<p>After extensive troubleshooting, I’ve successfully got PyTorch XPU working with Intel Arc Graphics on Linux. Sharing the complete solution to help others facing similar issues.</p>
<p><strong>Quick Verification:</strong></p>
<pre data-code-wrap="python"><code class="lang-python">import torch
print(f"PyTorch version: {torch.__version__}")
print(f"XPU compiled: {torch._C._xpu_getDeviceCount is not None}")
print(f"XPU available: {torch.xpu.is_available()}")
print(f"Device count: {torch.xpu.device_count()}")
print(f"Device name: {torch.xpu.get_device_name(0)}")

# Test tensor creation
x = torch.randn(3, 3, device='xpu')
print(f"Test tensor: {x.size()} {x.device}")
</code></pre>
<p><strong>Output:</strong></p>
<pre><code class="lang-auto">PyTorch version: 2.7.1+xpu
XPU compiled: True
XPU available: True
Device count: 1
Device name: Intel(R) Arc(TM) Graphics
Test tensor: torch.Size([3, 3]) xpu:0
</code></pre>
<h2><a name="p-471818-working-installation-command-3" class="anchor" href="#p-471818-working-installation-command-3"></a><img src="https://discuss.pytorch.org/images/emoji/apple/wrench.png?v=14" title=":wrench:" class="emoji" alt=":wrench:" loading="lazy" width="20" height="20"> Working Installation Command</h2>
<p>The solution that worked after 8 full conversations of iterations of troubleshooting: Approx 10 hours. (Point and laugh if you must, I am 6 months into my 100% Linux daily driver journey XD)</p>
<pre data-code-wrap="bash"><code class="lang-bash"># IMPORTANT: Complete clean uninstall first
pip uninstall -y torch torchvision torchaudio intel-cmplr-lib-rt intel-cmplr-lib-ur intel-cmplr-lic-rt intel-sycl-rt pytorch-triton-xpu tcmlib umf intel-pti

# Fresh install with all Intel runtime dependencies
pip install torch==2.7.1+xpu torchvision==0.22.1+xpu torchaudio==2.7.1+xpu intel-cmplr-lib-rt intel-cmplr-lib-ur intel-cmplr-lic-rt intel-sycl-rt pytorch-triton-xpu tcmlib umf intel-pti --index-url https://download.pytorch.org/whl/xpu --extra-index-url https://pypi.org/simple
</code></pre>
<h2><a name="p-471818-key-breakthrough-discovery-4" class="anchor" href="#p-471818-key-breakthrough-discovery-4"></a><img src="https://discuss.pytorch.org/images/emoji/apple/light_bulb.png?v=14" title=":light_bulb:" class="emoji" alt=":light_bulb:" loading="lazy" width="20" height="20"> Key Breakthrough Discovery</h2>
<p><strong>The Root Cause</strong>: Partial installations and version mixing between system packages and pip packages caused library path conflicts.</p>
<p><strong>The Solution</strong>: Complete clean slate reinstallation of the entire PyTorch XPU + Intel runtime stack.</p>
<h2><a name="p-471818-system-specifications-5" class="anchor" href="#p-471818-system-specifications-5"></a><img src="https://discuss.pytorch.org/images/emoji/apple/desktop_computer.png?v=14" title=":desktop_computer:" class="emoji" alt=":desktop_computer:" loading="lazy" width="20" height="20"> System Specifications</h2>
<ul>
<li><strong>Hardware</strong>: Intel Meteor Lake-P with integrated Arc Graphics</li>
<li><strong>OS</strong>: Arch Linux (kernel 6.x)</li>
<li><strong>Python</strong>: 3.11.6 via pyenv</li>
<li><strong>GPU</strong>: Intel Arc Graphics (128 compute units)</li>
<li><strong>Driver</strong>: i915 with GuC/HuC firmware</li>
</ul>
<h2><a name="p-471818-prerequisites-6" class="anchor" href="#p-471818-prerequisites-6"></a><img src="https://discuss.pytorch.org/images/emoji/apple/clipboard.png?v=14" title=":clipboard:" class="emoji" alt=":clipboard:" loading="lazy" width="20" height="20"> Prerequisites</h2>
<ol>
<li>
<p><strong>System Level Zero</strong> (install via package manager):</p>
<pre data-code-wrap="bash"><code class="lang-bash"># Arch Linux
sudo pacman -S level-zero-loader level-zero-headers

# Ubuntu/Debian
sudo apt install level-zero level-zero-dev
</code></pre>
</li>
<li>
<p><strong>Intel Compute Runtime</strong> (should be installed automatically with modern kernels)</p>
</li>
<li>
<p><strong>Verify GPU Detection</strong>:</p>
<pre data-code-wrap="bash"><code class="lang-bash">ls /dev/dri/  # Should show renderD128 or similar
clinfo        # Should list Intel GPU (if OpenCL tools installed)
</code></pre>
</li>
</ol>
<h2><a name="p-471818-critical-success-factors-7" class="anchor" href="#p-471818-critical-success-factors-7"></a><img src="https://discuss.pytorch.org/images/emoji/apple/warning.png?v=14" title=":warning:" class="emoji" alt=":warning:" loading="lazy" width="20" height="20"> Critical Success Factors</h2>
<h3><a name="p-471818-h-1-use-pytorch-271xpu-not-ipex-8" class="anchor" href="#p-471818-h-1-use-pytorch-271xpu-not-ipex-8"></a>1. Use PyTorch 2.7.1+xpu (Not IPEX)</h3>
<ul>
<li>PyTorch 2.7.1+xpu has <strong>native Intel GPU support</strong></li>
<li>No need for Intel Extension for PyTorch (IPEX)</li>
<li>XPU backend is built-in</li>
</ul>
<h3><a name="p-471818-h-2-install-all-intel-runtime-dependencies-9" class="anchor" href="#p-471818-h-2-install-all-intel-runtime-dependencies-9"></a>2. Install ALL Intel Runtime Dependencies</h3>
<p>The pip command above installs these essential Intel 2025.0.4 runtime components:</p>
<ul>
<li><code>intel-cmplr-lib-rt-2025.0.4</code></li>
<li><code>intel-cmplr-lib-ur-2025.0.4</code></li>
<li><code>intel-cmplr-lic-rt-2025.0.4</code></li>
<li><code>intel-sycl-rt-2025.0.4</code></li>
<li><code>pytorch-triton-xpu-3.3.1</code></li>
</ul>
<h3><a name="p-471818-h-3-clean-slate-installation-10" class="anchor" href="#p-471818-h-3-clean-slate-installation-10"></a>3. Clean Slate Installation</h3>
<ul>
<li>Don’t try to update existing installations</li>
<li>Uninstall everything PyTorch and Intel-related first</li>
<li>Fresh installation resolves library conflicts</li>
</ul>
<h2><a name="p-471818-common-issues-solutions-11" class="anchor" href="#p-471818-common-issues-solutions-11"></a><img src="https://discuss.pytorch.org/images/emoji/apple/bug.png?v=14" title=":bug:" class="emoji" alt=":bug:" loading="lazy" width="20" height="20"> Common Issues &amp; Solutions</h2>
<h3><a name="p-471818-issue-xpu-is-not-available-12" class="anchor" href="#p-471818-issue-xpu-is-not-available-12"></a>Issue: “XPU is not available”</h3>
<p><strong>Solution</strong>: Make sure you installed from the XPU index URL and included all Intel runtime dependencies.</p>
<h3><a name="p-471818-issue-segmentation-faults-or-crashes-13" class="anchor" href="#p-471818-issue-segmentation-faults-or-crashes-13"></a>Issue: Segmentation faults or crashes</h3>
<p><strong>Solution</strong>: Version conflicts between system and pip packages. Do complete uninstall/reinstall.</p>
<h3><a name="p-471818-issue-importerror-for-intel-libraries-14" class="anchor" href="#p-471818-issue-importerror-for-intel-libraries-14"></a>Issue: ImportError for Intel libraries</h3>
<p><strong>Solution</strong>: Install all Intel runtime dependencies listed in the command above.</p>
<h3><a name="p-471818-issue-level-zero-version-warnings-15" class="anchor" href="#p-471818-issue-level-zero-version-warnings-15"></a>Issue: Level Zero version warnings</h3>
<p><strong>Note</strong>: Version mismatch warnings between PyTorch expectations and system Level Zero are usually non-critical if basic tensor operations work.</p>
<h2><a name="p-471818-validation-steps-16" class="anchor" href="#p-471818-validation-steps-16"></a><img src="https://discuss.pytorch.org/images/emoji/apple/rocket.png?v=14" title=":rocket:" class="emoji" alt=":rocket:" loading="lazy" width="20" height="20"> Validation Steps</h2>
<p>After installation, verify everything works:</p>
<pre data-code-wrap="python"><code class="lang-python">import torch

# Basic checks
assert torch.xpu.is_available(), "XPU not available"
assert torch.xpu.device_count() &gt; 0, "No XPU devices found"

# Create and operate on XPU tensor
x = torch.randn(1000, 1000, device='xpu')
y = torch.randn(1000, 1000, device='xpu')
z = torch.mm(x, y)  # Matrix multiplication on GPU

print(f"✅ Success! Tensor device: {z.device}")
print(f"✅ GPU: {torch.xpu.get_device_name(0)}")
</code></pre>
<h2><a name="p-471818-what-this-enables-17" class="anchor" href="#p-471818-what-this-enables-17"></a><img src="https://discuss.pytorch.org/images/emoji/apple/chart_increasing.png?v=14" title=":chart_increasing:" class="emoji" alt=":chart_increasing:" loading="lazy" width="20" height="20"> What This Enables</h2>
<p>With working PyTorch XPU, you can now:</p>
<ul>
<li>Train neural networks on Intel GPU</li>
<li>Accelerate tensor computations</li>
<li>Use Intel Arc Graphics for AI workloads</li>
<li>Develop with native PyTorch GPU support</li>
</ul>
<h2><a name="p-471818-complete-documentation-18" class="anchor" href="#p-471818-complete-documentation-18"></a><img src="https://discuss.pytorch.org/images/emoji/apple/card_index_dividers.png?v=14" title=":card_index_dividers:" class="emoji" alt=":card_index_dividers:" loading="lazy" width="20" height="20"> Complete Documentation</h2>
<p>I’ve documented the entire troubleshooting journey with technical details, failed attempts, and system configuration info. The full technical report includes:</p>
<ul>
<li>8 iteration attempts with detailed failure analysis</li>
<li>Dependency conflict resolution</li>
<li>Fish shell compatibility notes</li>
<li>Performance validation steps</li>
</ul>
<h2><a name="p-471818-help-others-19" class="anchor" href="#p-471818-help-others-19"></a><img src="https://discuss.pytorch.org/images/emoji/apple/handshake.png?v=14" title=":handshake:" class="emoji" alt=":handshake:" loading="lazy" width="20" height="20"> Help Others</h2>
<p>If this helped you, please:</p>
<ul>
<li><img src="https://discuss.pytorch.org/images/emoji/apple/star.png?v=14" title=":star:" class="emoji" alt=":star:" loading="lazy" width="20" height="20"> Share your success in replies</li>
<li><img src="https://discuss.pytorch.org/images/emoji/apple/memo.png?v=14" title=":memo:" class="emoji" alt=":memo:" loading="lazy" width="20" height="20"> Note any variations for your system</li>
<li><img src="https://discuss.pytorch.org/images/emoji/apple/bug.png?v=14" title=":bug:" class="emoji" alt=":bug:" loading="lazy" width="20" height="20"> Report any issues you encounter</li>
</ul>
<h2><a name="p-471818-tags-20" class="anchor" href="#p-471818-tags-20"></a>Tags</h2>
<p><span class="hashtag-raw">#intel-gpu</span> <span class="hashtag-raw">#xpu</span> <span class="hashtag-raw">#arc-graphics</span> <span class="hashtag-raw">#pytorch-installation</span> <span class="hashtag-raw">#linux</span> <span class="hashtag-raw">#gpu-acceleration</span> <span class="hashtag-raw">#intel-arc</span></p>

username: Innomen
cooked: <p>lulz. I’m the first person this post helped. I had to point the ai at it to get the stuff working again after another install broke it <img src="https://discuss.pytorch.org/images/emoji/apple/stuck_out_tongue.png?v=14" title=":stuck_out_tongue:" class="emoji" alt=":stuck_out_tongue:" loading="lazy" width="20" height="20"> Thanks past self! X) (Hello future self? Back AGAIN?!)</p>

username: VladD
cooked: <p>Holy heck, this actually worked… On Windows 11 none the less, which makes it that more impressive!!!</p>
<p>Cheers!</p>

username: Innomen
cooked: <p>Thrilled to hear that! Thanks very much for letting me know.</p>

username: DrThodt2021
cooked: <p>Man, you are great! This guide works perfect and saved me a bunch of hours trying to find the proper versions. I mentioned your guide in a bug report for Automatic1111, hoping it helps a lot more people</p>

username: Innomen
cooked: <p>I’m really glad to hear that! And thanks for the kind words. I wish support for this hardware was better. Feeling like a slightly foolish early adopter at this point.</p>

username: Innomen
cooked: <p>Had the AI revisit this, same deal just refactored basically:</p>
<h1><a name="p-472432-pytorch-xpu-setup-guide-for-intel-arc-graphics-1" class="anchor" href="#p-472432-pytorch-xpu-setup-guide-for-intel-arc-graphics-1"></a>PyTorch XPU Setup Guide for Intel Arc Graphics</h1>
<p><strong>What this enables:</strong> Use your Intel Arc Graphics (integrated or discrete) to accelerate PyTorch operations - train neural networks, run AI models, and perform tensor computations on your Intel GPU instead of just CPU.</p>
<p><strong>Important note:</strong> This requires manual code changes to use the Intel GPU. Most existing AI applications won’t automatically benefit - they need to be specifically modified to support Intel XPU devices.</p>
<h2><a name="p-472432-h-1-prerequisites-2" class="anchor" href="#p-472432-h-1-prerequisites-2"></a>1. Prerequisites</h2>
<p>Install Level Zero support and verify your Intel GPU is detected:</p>
<pre data-code-wrap="bash"><code class="lang-bash"># Install Level Zero (choose your distro)
# Arch Linux:
sudo pacman -S level-zero-loader level-zero-headers
# Ubuntu/Debian:
sudo apt install level-zero level-zero-dev

# Verify Intel GPU detection
ls /dev/dri/  # Should show renderD128 or similar device files
</code></pre>
<h2><a name="p-472432-h-2-installation-3" class="anchor" href="#p-472432-h-2-installation-3"></a>2. Installation</h2>
<p>Complete clean installation to avoid version conflicts (works in fish shell):</p>
<pre data-code-wrap="bash"><code class="lang-bash"># Clean uninstall of existing packages
pip uninstall -y torch torchvision torchaudio intel-cmplr-lib-rt intel-cmplr-lib-ur intel-cmplr-lic-rt intel-sycl-rt pytorch-triton-xpu tcmlib umf intel-pti

# Fresh install with all Intel runtime dependencies
pip install torch==2.7.1+xpu torchvision==0.22.1+xpu torchaudio==2.7.1+xpu intel-cmplr-lib-rt intel-cmplr-lib-ur intel-cmplr-lic-rt intel-sycl-rt pytorch-triton-xpu tcmlib umf intel-pti --index-url https://download.pytorch.org/whl/xpu --extra-index-url https://pypi.org/simple
</code></pre>
<h2><a name="p-472432-h-3-confirmation-4" class="anchor" href="#p-472432-h-3-confirmation-4"></a>3. Confirmation</h2>
<p>Verify PyTorch can detect and use your Intel GPU:</p>
<pre data-code-wrap="python"><code class="lang-python">import torch

# Check XPU availability and device info
print(f"PyTorch version: {torch.__version__}")
print(f"XPU available: {torch.xpu.is_available()}")
print(f"Device count: {torch.xpu.device_count()}")
print(f"Device name: {torch.xpu.get_device_name(0)}")

# Test actual GPU computation
x = torch.randn(1000, 1000, device='xpu')
y = torch.randn(1000, 1000, device='xpu')
result = torch.mm(x, y)  # Matrix multiplication on Intel GPU
print(f"✅ GPU computation successful on: {result.device}")
</code></pre>
<p><strong>Expected output:</strong></p>
<pre><code class="lang-auto">PyTorch version: 2.7.1+xpu
XPU available: True
Device count: 1
Device name: Intel(R) Arc(TM) Graphics
✅ GPU computation successful on: xpu:0
</code></pre>
<p>If you see this output, PyTorch can successfully use your Intel Arc Graphics for GPU acceleration.</p>
<p><strong>Remember:</strong> You’ll need to explicitly specify <code>device='xpu'</code> in your PyTorch code to actually use the Intel GPU - it won’t happen automatically.</p>

username: DrThodt2021
cooked: <p>That seems very odd. I’m stumbling about the “important note” and the “remember” sentence. Could you please specify which AI you used on that?<br>
Your Guide in the first topic works flawless as expected, but there is no need to change any “PyTorch code”.</p>
<p>What I found is a special behavior in the way Automatic1111 (a webUI for Stable Diffusion) detects the hardware abilities of the used GPU, especially for Intel GPUs (XPU Devices). To make Automatic1111 work propper with Intel GPU, you have to modify it’s code but this has nothing to do with Torch or PyTorch itself.</p>
<p>I think the revised instructions could be missleading.</p>
<p>EDIT: Oh, and also please remove the emote in the output (and also in the print statement). That’s something AI likes very much, but most terminals don’t show them either.</p>