Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

macOS Python wheel _portable_lib has non-relocatable libtorch rpath

オープン
#23,742 コメント 1 件 リアクション 0 件 担当者 2 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@JacobSzwejbka がすでに取り組んでいます。

2026年10月14日 から。

評価

この issue はまだ評価されていません。

説明

Summary

The macOS ExecuTorch nightly wheel installs executorch.extension.pybindings._portable_lib, but its Mach-O rpath points at a CI-only Torch directory. On a normal virtual environment, importing the module fails because @rpath/libtorch_python.dylib cannot be resolved.

It can be worked around with

DYLD_FALLBACK_LIBRARY_PATH="$VIRTUAL_ENV/lib/python3.13/site-packages/torch/lib${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}" python -c 'import
  │ executorch.extension.pybindings._portable_lib; print("portable pybind runtime loaded")'

Environment

  • macOS
  • Python 3.13.3
  • executorch==1.4.0.dev20260818
  • torch==2.13.0

Reproduction

python -c "import executorch.extension.pybindings._portable_lib"

The import fails with:

dlopen(.../_portable_lib.cpython-313-darwin.so, 0x0002): Library not loaded: @rpath/libtorch_python.dylib
Reason: tried: '/Users/runner/work/_temp/conda_environment_32133036333/lib/python3.13/site-packages/torch/lib/libtorch_python.dylib' (no such file), 

Evidence

otool -L venv/lib/python3.13/site-packages/executorch/extension/pybindings/_portable_lib.cpython-313-darwin.so
otool -l venv/lib/python3.13/site-packages/executorch/extension/pybindings/_portable_lib.cpython-313-darwin.so

The extension links against:

@rpath/libtorch_python.dylib
@rpath/libtorch.dylib
@rpath/libtorch_cpu.dylib
@rpath/libc10.dylib

but contains only this rpath:

Load command 25
          cmd LC_RPATH
      cmdsize 112
         path /Users/runner/work/_temp/conda_environment_32133036333/lib/python3.13/site-packages/torch/lib (offset 12)

That build-machine path does not exist for wheel users.

Expected behavior

The wheel should be relocatable: _portable_lib should locate the libtorch*.dylib files supplied by the installed Torch wheel, for example via an appropriate relative @loader_path/@rpath installation layout or a repaired wheel rpath.

Actual behavior

The native runtime cannot load, so downstream packages cannot register native backends against it. The failure can be easy to miss when callers catch OSError to keep their Python package importable; backend availability then fails later at model load.

主要言語
Python
スター
5.1k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
713

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pytorch/executorch のほかの issue

pytorch/executorch の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。