pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
1.94k stars 321 forks source link

Can't build CoreML Delegate #5983

Open byjlw opened 1 week ago

byjlw commented 1 week ago

🐛 Describe the bug

Trying to follow the readme https://github.com/pytorch/executorch/blob/main/backends/apple/coreml/setup.md

Running this command ./build/build_apple_frameworks.sh --coreml results in the following error

CMake Error at build/Utils.cmake:261 (message):
  Failed to resolve buck2.

  Failed to retrieve buck2 version: Error: Could not read dotslash file
  /Users/byjlw/Documents/source/working/executorch-testing/executorch/.buck2:
  No such file or directory (os error 2)

  .

  The provided buck2 binary "/usr/local/bin/buck2" reports version "None",
  but ExecuTorch needs version "99773fe6f7963a72ae5f7b737c02836e".  Ensure
  that the correct buck2 version is installed or avoid explicitly passing the
  BUCK2 version to automatically download the correct version.

Call Stack (most recent call first):
  CMakeLists.txt:331 (resolve_buck2)

Versions

Operating System Information Darwin byjlw-mbp 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

This is NOT something we should do normally and could cause issues with

chef, but due to libdnf hardcoding this check into the code we're forced

to set this until it is fix upstream.

https://github.com/rpm-software-management/libdnf/issues/1221

VERSION_ID=11

Python Version Python 3.11.9

PIP Version pip 24.2 from /Users/byjlw/Documents/source/working/executorch-testing/.venv/lib/python3.11/site-packages/pip (python 3.11)

Installed Packages attrs==24.2.0 cattrs==24.1.2 certifi==2024.8.30 charset-normalizer==3.3.2 cmake==3.30.4 coremltools @ file:///Users/byjlw/Documents/source/working/executorch-testing/executorch/backends/apple/coreml/third-party/coremltools execnet==2.1.1 executorch @ file:///Users/byjlw/Documents/source/working/executorch-testing/executorch executorchcoreml @ file:///Users/byjlw/Documents/source/working/executorch-testing/executorch/backends/apple/coreml/runtime/inmemoryfs expecttest==0.2.1 filelock==3.16.1 flatbuffers==24.3.25 fsspec==2024.9.0 huggingface-hub==0.25.1 hypothesis==6.112.2 idna==3.10 iniconfig==2.0.0 Jinja2==3.1.4 MarkupSafe==2.1.5 mpmath==1.3.0 networkx==3.3 numpy==1.26.4 packaging==24.1 pandas==2.2.3 parameterized==0.9.0 pillow==10.4.0 pluggy==1.5.0 protobuf==5.28.2 pyaml==24.9.0 pytest==8.3.3 pytest-xdist==3.6.1 python-dateutil==2.9.0.post0 pytz==2024.2 PyYAML==6.0.2 regex==2024.9.11 requests==2.32.3 ruamel.yaml==0.18.6 ruamel.yaml.clib==0.2.8 safetensors==0.4.5 six==1.16.0 sortedcontainers==2.4.0 sympy==1.13.1 tabulate==0.9.0 timm==1.0.7 tokenizers==0.19.1 tomli==2.0.2 torch==2.6.0.dev20241002 torchaudio==2.5.0.dev20241002 torchsr==1.0.4 torchvision==0.20.0.dev20241002 tqdm==4.66.5 transformers==4.42.4 typing_extensions==4.12.2 tzdata==2024.2 urllib3==2.2.3 zstd==1.5.5.1

PyTorch Version 2.6.0.dev20241002

Collection Complete

dbort commented 1 week ago

The problem is the $(which buck2) at https://github.com/pytorch/executorch/blob/fe295b9a326c5fa372efa3f94de5c04b9bce2d2f/build/build_apple_frameworks.sh#L14. At this point, no scripts or users should pass the BUCK2 option to cmake unless they really need to override it (maybe because they're running on a system with no network access).

@shoumikhin is going to update the script to avoid using the buck2 on the path.