Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

macOS Python wheel _portable_lib has non-relocatable libtorch rpath

未关闭
#23,742 1 条评论 0 个 reaction 已指派 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
平均合并
2 天 51 分钟
30 天内合并 PR
712

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pytorch/executorch 的其他 Issue

查看 pytorch/executorch 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。