Skip to content

Error on import protable_lib via pybindings #9745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
guangy10 opened this issue Mar 28, 2025 · 3 comments
Open

Error on import protable_lib via pybindings #9745

guangy10 opened this issue Mar 28, 2025 · 3 comments
Assignees
Labels
module: extension Issues related to code under extension/ module: user experience Issues related to reducing friction for users triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@guangy10
Copy link
Contributor

guangy10 commented Mar 28, 2025

🐛 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 (7030b33).

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

@guangy10
Copy link
Contributor Author

Max and I are digging into this issue a log. We tried creating new conda env and inspecting the installed pybindings under the correct conda env, and we also tried completely deleting optimum-executorch locally and make a fresh clone and installation. None makes any difference to us. That is, things keep working for him, and keeps failing for me.

Finally I can get things working after I deleted executorch completely, and re-clone and install it from scratch (within an existing conda env, that is, everything else remains unchanged). And unfortunately, we lost all hints to debug into this weird issue after removing the local copy.

Just a heads-up here, if anyone recently run into the same issue, please let us know, per Max's suggestion, we may want to try more things, it could be the pycahce causing the issue, or we may need to provide a way to uninstall first.

@guangy10
Copy link
Contributor Author

guangy10 commented Mar 28, 2025

For now, it should not be a blocker for 0.6 release, so I will move it back to our backlog then. cc: @mergennachin

@guangy10 guangy10 added module: extension Issues related to code under extension/ module: user experience Issues related to reducing friction for users labels Mar 28, 2025
@github-project-automation github-project-automation bot moved this to To triage in ExecuTorch DevX Mar 28, 2025
@guangy10 guangy10 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Mar 28, 2025
@guangy10
Copy link
Contributor Author

tagged the task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: extension Issues related to code under extension/ module: user experience Issues related to reducing friction for users triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Status: To triage
Status: To triage
Development

No branches or pull requests

3 participants