Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

macOS Python wheel _portable_lib has non-relocatable libtorch rpath

Aberta
#23,742 1 comentário 0 reações 2 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@JacobSzwejbka já está trabalhando nisso.

Desde 14/10/2026.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

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.

Linguagem predominante
Python
Estrelas
5.1k
Forks
1.2k
Merge médio
1d 23h
PRs com merge (30d)
713

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de pytorch/executorch

Todas as issues de pytorch/executorch

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.