Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

macOS Python wheel _portable_lib has non-relocatable libtorch rpath

Ouverte
#23,742 1 commentaire 0 réactions 2 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@JacobSzwejbka y travaille déjà.

Depuis le 14/10/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

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.

Langage dominant
Python
Étoiles
5.1k
Forks
1.2k
Merge moyen
1 j 23 h
PR mergées (30 j)
713

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pytorch/executorch

Toutes les issues de pytorch/executorch

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.