pytorch / executorch

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

Swift package checksum failure #4396

Closed ccharp closed 1 month ago

ccharp commented 1 month ago

🐛 Describe the bug

I'm following the "Building an ExecuTorch iOS Demo App" tutorial here: https://pytorch.org/executorch/stable/demo-apps-ios.html

I try to build and test the app with the following CLI:

xcrun simctl create executorch "iPhone 15"
xcodebuild clean test \
     -project examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj \
     -scheme App \
     -destination name=executorch
xcrun simctl delete executorch

I get the following errors:

xcodebuild: error: Could not resolve package dependencies:
  checksum of downloaded artifact of binary target 'quantized_backend' (d23c52bb6f3d40e0f6bf54e39e63c535f328a71a11cfae90c6d7f909ba159b8f) does not match checksum specified by the manifest (f670ed609cf798a664425cc7fb1c3dc56d40f5a5622980b7d9ff5a277de12bb6)
  checksum of downloaded artifact of binary target 'mps_backend' (03f8ffdd1b4bc1c365c26edb948f1c2e12ad7cb41df9b8b8441e89857421d353) does not match checksum specified by the manifest (1f06d36b52d4d24d821387f1e17b5f1f64d93e9ed2ed6a4907ce17436c61c603)
  checksum of downloaded artifact of binary target 'executorch' (a693533614462b24dc175c72a7b5f5c2c0146eceb7339f173c06b914b6a3e69d) does not match checksum specified by the manifest (8b33727b760bc96b0ec966a3a1ceed205f930a42a921c486da1caa91a6fff3c3)
  checksum of downloaded artifact of binary target 'custom_backend_debug' (028cf558b713b49bc4f5f4ee816d43818f2d6a416be94da0f8a256d3ad937202) does not match checksum specified by the manifest (8e5b399f6750ee97bd7373a6d78d179ff0076742ec3e718351803659a6219a92)
  checksum of downloaded artifact of binary target 'quantized_backend_debug' (d779da85424b8f7491450fb36d4f1d646c48e131b66e9d5f6f9f81c4de9c1237) does not match checksum specified by the manifest (ba99d1b31a2414a30131c53cb6bcf202addc263dea5785921490aa26769bc01c)
  checksum of downloaded artifact of binary target 'executorch_debug' (c043675c5b19347af6299413aa27c8bf06877d49254e0aece9b531244b068ecc) does not match checksum specified by the manifest (bc4220b1417ec1ff63092ff4191c00ce82b20b4da1d11a4067083b13c6f9dd90)
  checksum of downloaded artifact of binary target 'xnnpack_backend' (2ccb6d4f3fba528d5abd1076580ff7b41f3263d968fa9ce6ae73b1e564e15b97) does not match checksum specified by the manifest (fbbe1cdb0dec8efd0d2e2b4acbd503230113404c7f3e99cebe36d196f845f662)
  checksum of downloaded artifact of binary target 'optimized_backend' (8f050023869eda1fc610c344151df0ca99a02a3eeeb4a8cb2b017c0fd1784559) does not match checksum specified by the manifest (f1e0ad6905da488aa32056756dddc629b6ab565e18a05bb721267a5be68ae859)
  checksum of downloaded artifact of binary target 'mps_backend_debug' (4141537aa4791d8245924704dbba3d6b8dacde74e0cf9ebbe0b78b780861d6ed) does not match checksum specified by the manifest (1eb38e9cb45f320d45489b9e54c0f6468274b2575d45e5f921d1d88b0cc40df4)
  checksum of downloaded artifact of binary target 'coreml_backend' (9471702164d84d3b4f8da96cac796d9a2474d243175b25638e82546ca7786b77) does not match checksum specified by the manifest (1d81d3719812b6f26c518479dd999520266bebbf3c867c1b686c0ac43e467555)
  checksum of downloaded artifact of binary target 'custom_backend' (451917bd432fb66494d29d55711fdf389134c2953bdafa3cfc2c36ddc62b685f) does not match checksum specified by the manifest (ec1b94af1b74dadb5c78ea482366ef445dbde43a62cc2ee49986356f1983e049)
  checksum of downloaded artifact of binary target 'coreml_backend_debug' (4597f06bb91eab7014a959e060cccf4e7f9ffdfe2f62d548ef6589cb797824b9) does not match checksum specified by the manifest (25fa8e4dd74d253d0f3fb66192f48c1e7384fb0d110003928e3b9aa25f22fe14)
  checksum of downloaded artifact of binary target 'xnnpack_backend_debug' (0227c730e33e9a51ebd46fb59bb3997403ec2724f0bd8cc7e7e8308b5d2c50b7) does not match checksum specified by the manifest (d1b1b0e512c8cee2583ca7c9ae71fc3fb81dad11063c216866061cfc323b2ec2)
  checksum of downloaded artifact of binary target 'portable_backend' (dcf0a1c5cf5a6a07ba35d96958dfa5b89d31e5984fa8ec24316ebae4f9eb63bb) does not match checksum specified by the manifest (079d41baaa6c2decbfa2061c62cc038a7587f9caf740fe58e63cedb85c8ff998)
  checksum of downloaded artifact of binary target 'optimized_backend_debug' (e98e75ca84982f0aee1182177a0878b3f93e373d6189e9a776c8ddd2354f8f78) does not match checksum specified by the manifest (3ce0a8be0e9f6abfd32836b7a80c036efbe909b5870ec6fa32e9f134cfcc3afd)
  checksum of downloaded artifact of binary target 'portable_backend_debug' (eb8b4407d8fbf9b8489be2de9df2b701681a675e31ce708185d2e9d9e3562c4d) does not match checksum specified by the manifest (492bb0a6c7941be713d8755aa4d968b019d8a7aa9e63cef90a8a32d21ff6cf76)
  fatalError

I have tried restarting xcode and my mac, and clearing all local caches I could think of:

rm -rf ~/Library/Developer/Xcode/DerivedData    
rm -rf ~/Library/Caches/org.swift.swiftpm 
rm -rf ~/Library/org.swift.swiftpm/configuration
rm -rf ~/Library/org.swift.swiftpm/security

Versions

PyTorch version: 2.3.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 14.5 (arm64)
GCC version: Could not collect
Clang version: 15.0.0 (clang-1500.1.0.2.5)
CMake version: version 3.30.0
Libc version: N/A

Python version: 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] (64-bit runtime)
Python platform: macOS-14.5-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.2.1a0+088cedf
[pip3] executorchcoreml==0.0.1
[pip3] numpy==1.23.2
[pip3] torch==2.3.1
[pip3] torchaudio==2.3.1
[pip3] torchsr==1.0.4
[pip3] torchvision==0.18.1
[conda] executorch                0.2.1a0+088cedf          pypi_0    pypi
[conda] executorchcoreml          0.0.1                    pypi_0    pypi
[conda] numpy                     1.23.2                   pypi_0    pypi
[conda] torch                     2.3.1                    pypi_0    pypi
[conda] torchaudio                2.3.1                    pypi_0    pypi
[conda] torchsr                   1.0.4                    pypi_0    pypi
[conda] torchvision               0.18.1                   pypi_0    pypi

I'm also using ExecuTorch branch v0.2.1

shoumikhin commented 1 month ago

Hi Corbin,

Some of the caches aren't clear still, we need to figure out which and let Xcode re-download the packages, please try to:

rm -rf ~/Library/org.swift.swiftpm

And nuke the Derived Data entirely.

You may also like to try the latest release:

git clone https://github.com/pytorch/executorch.git --branch release/0.3 --recursive && cd executorch
ccharp commented 1 month ago

@shoumikhin thanks for the reply!

I had success (with a caveat) with v0.3. For some reason, my local conda environment did not install the version of numpy specified in pyprojct.toml. The following completed successfully:

./backends/apple/coreml/scripts/install_requirements.sh

./backends/apple/mps/install_requirements.sh

However, I got a runtime error related to incompatible versions of Pandas and Numpy when running

python3 -m examples.portable.scripts.export --model_name="mv3"

I had to manually install the correct version of NumPy to complete the remaining build steps:

(executorch-0.3) csc-wt@Stargazer ~/git/executorch ‹release/0.3› 
$ pip install --force-reinstall -v numpy==1.25.2

Note that pyproject.toml specifies numpy>=1.25.2.

I did not have success with v0.2.1. Same errors, though I wonder, since no one else is reproducing, if I had some stale submodule state or something. I did a clean clone for 0.3.

shoumikhin commented 1 month ago

@ccharp that should be fixed on the main branch by https://github.com/pytorch/executorch/pull/4430