pytorch - 💡(How to fix) Fix CPU wheels from download.pytorch.org/whl/cpu missing torch/csrc/ and c10/ headers needed by torch.compile (inductor) [5 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#179414Fetched 2026-04-08 02:51:55
View on GitHub
Comments
5
Participants
2
Timeline
194
Reactions
0
Participants
Timeline (top)
mentioned ×88subscribed ×88labeled ×9commented ×5

The CPU-only PyTorch wheels distributed via https://download.pytorch.org/whl/cpu ship a stripped-down torch/include/ directory that only contains ATen/ headers (57 files). The torch/csrc/ and c10/ header directories are missing entirely.

This breaks torch.compile (inductor backend) at runtime because the C++ code generation step needs torch/csrc/inductor/cpp_prefix.h and its transitive includes from c10/.

The regular PyPI wheels (CUDA) include the full torch/include/ tree (~9,300+ files) and work fine with torch.compile.

Error Message

fatal error: torch/csrc/inductor/cpp_prefix.h: No such file or directory

Root Cause

This breaks torch.compile (inductor backend) at runtime because the C++ code generation step needs torch/csrc/inductor/cpp_prefix.h and its transitive includes from c10/.

Fix Action

Fix / Workaround

Current Workaround

Code Example

pip install torch --index-url https://download.pytorch.org/whl/cpu
python -c "
import torch, os
inc = os.path.join(os.path.dirname(torch.__file__), 'include')
cpp = os.path.join(inc, 'torch', 'csrc', 'inductor', 'cpp_prefix.h')
print('torch version:', torch.__version__)
print('include/ exists:', os.path.isdir(inc))
print('include/ contents:', os.listdir(inc))
print('cpp_prefix.h exists:', os.path.exists(cpp))
"

---

torch version: 2.11.0+cpu
include/ exists: True
include/ contents: ['ATen']
cpp_prefix.h exists: False

---

fatal error: torch/csrc/inductor/cpp_prefix.h: No such file or directory
RAW_BUFFERClick to expand / collapse

Description

The CPU-only PyTorch wheels distributed via https://download.pytorch.org/whl/cpu ship a stripped-down torch/include/ directory that only contains ATen/ headers (57 files). The torch/csrc/ and c10/ header directories are missing entirely.

This breaks torch.compile (inductor backend) at runtime because the C++ code generation step needs torch/csrc/inductor/cpp_prefix.h and its transitive includes from c10/.

The regular PyPI wheels (CUDA) include the full torch/include/ tree (~9,300+ files) and work fine with torch.compile.

Steps to Reproduce

pip install torch --index-url https://download.pytorch.org/whl/cpu
python -c "
import torch, os
inc = os.path.join(os.path.dirname(torch.__file__), 'include')
cpp = os.path.join(inc, 'torch', 'csrc', 'inductor', 'cpp_prefix.h')
print('torch version:', torch.__version__)
print('include/ exists:', os.path.isdir(inc))
print('include/ contents:', os.listdir(inc))
print('cpp_prefix.h exists:', os.path.exists(cpp))
"

Output:

torch version: 2.11.0+cpu
include/ exists: True
include/ contents: ['ATen']
cpp_prefix.h exists: False

Expected Behavior

The CPU wheel should include the same torch/include/ headers as the CUDA wheel, or at minimum the headers required by torch.compile (inductor):

  • torch/csrc/inductor/cpp_prefix.h
  • torch/csrc/inductor/aoti_torch/
  • c10/util/BFloat16.h, c10/util/Half.h, etc.
  • c10/macros/ and c10/core/

Impact

Any project using torch.compile with a CPU wheel hits this at runtime:

fatal error: torch/csrc/inductor/cpp_prefix.h: No such file or directory

This affects vLLM CPU inference (which uses torch.compile by default since v0.17.0), and likely any other project relying on inductor's C++ backend on CPU-only installations.

Current Workaround

We download the matching CUDA wheel from PyPI and extract only the include/ directory into the CPU installation. This adds ~10 seconds to Docker builds and feels like something that should be handled at the wheel packaging level.

Environment

  • PyTorch: 2.11.0+cpu (also confirmed on 2.10.0+cpu)
  • Platform: linux x86_64 and aarch64
  • Install: pip install torch --index-url https://download.pytorch.org/whl/cpu
  • CUDA wheels from pypi.org/project/torch/ include the full headers and work correctly

cc @seemethere @malfet @atalman @tinglvv @nWEIdia @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @aditew01 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

extent analysis

TL;DR

The CPU-only PyTorch wheel is missing necessary headers, so downloading the CUDA wheel and extracting the include/ directory can serve as a temporary workaround.

Guidance

  • Verify that the issue is indeed caused by the missing headers in the CPU-only PyTorch wheel by checking the include/ directory contents.
  • Consider using the CUDA wheel instead, which includes the full torch/include/ tree, as a temporary solution.
  • If using the CPU-only wheel is necessary, extract the required headers (torch/csrc/inductor/cpp_prefix.h, c10/util/BFloat16.h, etc.) from the CUDA wheel and add them to the CPU installation.
  • Be aware that this workaround may add extra time to Docker builds, as mentioned in the issue.

Notes

The provided workaround may not be ideal, as it requires downloading the CUDA wheel and extracting the necessary headers, which can add complexity to the installation process.

Recommendation

Apply the workaround of downloading the CUDA wheel and extracting the include/ directory, as it is the most straightforward solution given the current state of the CPU-only PyTorch wheel.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - 💡(How to fix) Fix CPU wheels from download.pytorch.org/whl/cpu missing torch/csrc/ and c10/ headers needed by torch.compile (inductor) [5 comments, 2 participants]