pytorch / pytorch/executorch

Error on import protable_lib via pybindings

Open
#9,745 9 comments 0 reactions 2 assignees View on GitHub

@larryliu0820 is already working on this.

Since Mar 28, 2025.

module: extension module: user experience triaged
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🐛 Describe the bug

Here is the error and stack trace:

Traceback:
../miniconda3/envs/executorch/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/models/test_modeling_pvt.py:23: in <module>
    from executorch.extension.pybindings.portable_lib import ExecuTorchModule
../miniconda3/envs/executorch/lib/python3.11/site-packages/executorch/extension/pybindings/portable_lib.py:36: in <module>
    from executorch.extension.pybindings._portable_lib import (  # noqa: F401
E   ImportError: dlopen(/Users/guangyang/miniconda3/envs/executorch/lib/python3.11/site-packages/executorch/extension/pybindings/_portable_lib.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '__ZN10executorch7runtime8internal18resize_tensor_implEPN5torch8executor10TensorImplENS0_8ArrayRefIiEE'

I have confirmed this issue is new and exist on both release/0.6 and main (7030b33048ad048d873aafad794d0b4e500fd23f).

I notice this issue when updating my local checkout to latest main, as a comparson, the pybindings works fine on an older commit (0342babc505bcb90244874e9ed9218d90dd67b87) from Tue this week, so likely the issue is introduced very recently.

I caught this issue on optimum-executch, unfortunately, I don't know if there is another way to repo, I will just share the repo steps from optimum-executch:

  1. clone the optimum-executorch repo and follow the setup guide here: https://github.com/huggingface/optimum-executorch
  2. run an unit test: RUN_SLOW=1 pytest tests/models/test_modeling_bert.py -v -s -k mask
    You will see the error
Versions

Collecting environment information...
PyTorch version: 2.7.0.dev20250310
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 15.3.2 (arm64)
GCC version: Could not collect
Clang version: 16.0.0 (clang-1600.0.26.6)
CMake version: version 3.31.4
Libc version: N/A

Python version: 3.11.11 (main, Dec 11 2024, 10:25:04) [Clang 14.0.6 ] (64-bit runtime)
Python platform: macOS-15.3.2-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Apple M1 Max

Versions of relevant libraries:
[pip3] executorch==0.6.0a0+92408be
[pip3] flake8==6.1.0
[pip3] flake8-breakpoint==1.1.0
[pip3] flake8-bugbear==24.4.26
[pip3] flake8-comprehensions==3.14.0
[pip3] flake8-plugin-utils==1.3.3
[pip3] flake8-pyi==23.5.0
[pip3] mypy==1.14.1
[pip3] mypy-extensions==1.0.0
[pip3] numpy==2.2.4
[pip3] optimum-executorch==0.0.0.dev0
[pip3] torch==2.7.0.dev20250310
[pip3] torchao==0.10.0+git923242e2
[pip3] torchaudio==2.6.0.dev20250310
[pip3] torchsr==1.0.4
[pip3] torchvision==0.22.0.dev20250310
[conda] executorch 0.6.0a0+92408be pypi_0 pypi
[conda] numpy 2.2.4 pypi_0 pypi
[conda] optimum-executorch 0.0.0.dev0 pypi_0 pypi
[conda] torch 2.7.0.dev20250310 pypi_0 pypi
[conda] torchao 0.10.0+git923242e2 pypi_0 pypi
[conda] torchaudio 2.6.0.dev20250310 pypi_0 pypi
[conda] torchfix 0.6.0 pypi_0 pypi
[conda] torchsr 1.0.4 pypi_0 pypi
[conda] torchvision 0.22.0.dev20250310 pypi_0 pypi

cc @mergennachin @byjlw

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.