pytorch - 💡(How to fix) Fix torchgen/packaged/autograd/BUILD.bazel shipped in installed wheel breaks downstream Bazel builds [1 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#182722Fetched 2026-05-07 03:30:30
View on GitHub
Comments
0
Participants
1
Timeline
23
Reactions
0
Author
Participants
Timeline (top)
mentioned ×10subscribed ×10labeled ×3

Error Message

ERROR: /home/vscode/.cache/bazel/_bazel_vscode/93fd2cd9b3c5d87ae416561bff883334/external/legacyPackages.aarch64-linux.python3Packages.torch.out/BUILD.bazel:10:14: Label '@@legacyPackages.aarch64-linux.python3Packages.torch.out//:lib/python3.12/site-packages/torchgen/packaged/autograd/init.py' is invalid because '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd' is a subpackage; perhaps you meant to put the colon here: '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd:init.py'?

Root Cause

Installed PyTorch wheels contain torchgen/packaged/autograd/BUILD.bazel and torchgen/packaged/autograd/build.bzl. These files have no runtime purpose for the torchgen package, and their presence breaks downstream Bazel builds that depend on PyTorch, as they assume there would be no Bazel subpackages in the installed Python package:

ERROR: /home/vscode/.cache/bazel/_bazel_vscode/93fd2cd9b3c5d87ae416561bff883334/external/legacyPackages.aarch64-linux.python3Packages.torch.out/BUILD.bazel:10:14: Label '@@legacyPackages.aarch64-linux.python3Packages.torch.out//:lib/python3.12/site-packages/torchgen/packaged/autograd/__init__.py' is invalid because '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd' is a subpackage; perhaps you meant to put the colon here: '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd:__init__.py'?

Fix Action

Fix / Workaround

CPU: Architecture: aarch64 CPU op-mode(s): 64-bit Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Vendor ID: Ampere Model name: Ampere-1a Model: 0 Thread(s) per core: 1 Core(s) per cluster: 128 Socket(s): - Cluster(s): 1 Stepping: 0x0 Frequency boost: disabled CPU(s) scaling MHz: 100% CPU max MHz: 3400.0000 CPU min MHz: 1000.0000 BogoMIPS: 2000.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 rng bti ecv L1d cache: 8 MiB (128 instances) L1i cache: 2 MiB (128 instances) L2 cache: 256 MiB (128 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-127 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; __user pointer sanitization Vulnerability Spectre v2: Not affected Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Not affected

Code Example

ERROR: /home/vscode/.cache/bazel/_bazel_vscode/93fd2cd9b3c5d87ae416561bff883334/external/legacyPackages.aarch64-linux.python3Packages.torch.out/BUILD.bazel:10:14: Label '@@legacyPackages.aarch64-linux.python3Packages.torch.out//:lib/python3.12/site-packages/torchgen/packaged/autograd/__init__.py' is invalid because '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd' is a subpackage; perhaps you meant to put the colon here: '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd:__init__.py'?
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

Installed PyTorch wheels contain torchgen/packaged/autograd/BUILD.bazel and torchgen/packaged/autograd/build.bzl. These files have no runtime purpose for the torchgen package, and their presence breaks downstream Bazel builds that depend on PyTorch, as they assume there would be no Bazel subpackages in the installed Python package:

ERROR: /home/vscode/.cache/bazel/_bazel_vscode/93fd2cd9b3c5d87ae416561bff883334/external/legacyPackages.aarch64-linux.python3Packages.torch.out/BUILD.bazel:10:14: Label '@@legacyPackages.aarch64-linux.python3Packages.torch.out//:lib/python3.12/site-packages/torchgen/packaged/autograd/__init__.py' is invalid because '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd' is a subpackage; perhaps you meant to put the colon here: '@@legacyPackages.aarch64-linux.python3Packages.torch.out//lib/python3.12/site-packages/torchgen/packaged/autograd:__init__.py'?

Versions

We have a pretty exotic setup with Nix and Bazel, so the provided script is unable to collect many of the details, but I don't think they really matter for this issue except for the fact that this issue is present in all wheels from 2.10.0 (and probably long before that) to current nightly builds.

PyTorch version: 2.10.0 Is debug build: False CUDA used to build PyTorch: 12.4 ROCM used to build PyTorch: N/A

OS: Ubuntu 24.04.4 LTS (aarch64) GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 Clang version: Could not collect CMake version: Could not collect Libc version: glibc-2.40

Python version: 3.12.11 (main, Jun 3 2025, 15:41:47) [GCC 14.3.0] (64-bit runtime) Python platform: Linux-6.8.0-106-generic-aarch64-with-glibc2.40 Is CUDA available: False CUDA runtime version: Could not collect CUDA_MODULE_LOADING set to: N/A GPU models and configuration: GPU 0: NVIDIA RTX PRO 6000 Blackwell Server Edition Nvidia driver version: 580.105.08 cuDNN version: Could not collect Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True Caching allocator config: N/A

CPU: Architecture: aarch64 CPU op-mode(s): 64-bit Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Vendor ID: Ampere Model name: Ampere-1a Model: 0 Thread(s) per core: 1 Core(s) per cluster: 128 Socket(s): - Cluster(s): 1 Stepping: 0x0 Frequency boost: disabled CPU(s) scaling MHz: 100% CPU max MHz: 3400.0000 CPU min MHz: 1000.0000 BogoMIPS: 2000.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 rng bti ecv L1d cache: 8 MiB (128 instances) L1i cache: 2 MiB (128 instances) L2 cache: 256 MiB (128 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-127 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; __user pointer sanitization Vulnerability Spectre v2: Not affected Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Not affected

Versions of relevant libraries: [pip3] Could not collect [conda] Could not collect

cc @seemethere @malfet @atalman @tinglvv @nWEIdia

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 torchgen/packaged/autograd/BUILD.bazel shipped in installed wheel breaks downstream Bazel builds [1 participants]