tflite-support
tflite-support copied to clipboard
ios TensorFlowLiteTaskVision build error (env: python: No such file or directory)
I am having build issues on MacOs 12.3. The issue is directly related to bazel and changes in MacOS. build script:
FRAMEWORK_NAME=TensorFlowLiteTaskVision DEST_DIR=iosbuild
./tensorflow_lite_support/tools/ci_build/builds/build_ios_framework.sh
Error
ERROR: /Users/tj/projects/edgestore/ModelsAPI/inference/tfliteframework/task/tflite-support/tensorflow_lite_support/ios/BUILD:69:21: Bundling Preprocessed_TensorFlowLiteTaskVisionC_framework failed: (Exit 127): bundletool failed: error executing command
(cd /private/var/tmp/_bazel_tj/5d20e619fbfca68099aa0f179b25fe42/execroot/org_tensorflow_lite_support && \
exec env - \
bazel-out/host/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool bazel-out/applebin_ios-ios_arm64-opt-ST-02f4a105b518/bin/tensorflow_lite_support/ios/Preprocessed_TensorFlowLiteTaskVisionC_framework-intermediates/bundletool_control.json)
Execution platform: @local_execution_config_platform//:platform
env: python: No such file or directory
Target //tensorflow_lite_support/ios:TensorFlowLiteTaskVisionC_framework failed to build
INFO: Elapsed time: 0.179s, Critical Path: 0.01s
INFO: 2 processes: 2 internal.
I already have python2 and python3 and both binary directories are in PATH variable. What I understand from my research the problem is that Apple removed python 2 and there is no /usr/bin/python binary and no way to add it there. This causes this particular error in bazel versions < 5.0.0. (similar error for reference).
Is it possible to fix this issue and if not can someone please point me to prebuilt binaries?
Try if it works by configuring the Python bin path explicitly, such
PYTHON_BIN_PATH=$(which python3)
export PYTHON_BIN_PATH
@priankakariatyml FYI
Try if it works by configuring the Python bin path explicitly, such
PYTHON_BIN_PATH=$(which python3) export PYTHON_BIN_PATH
Sorry, same issue
Then try if the following works for you:
PYTHON_BIN_PATH=$(which python3)
export PYTHON_BIN_PATH
sudo rm -f /usr/bin/python3
sudo ln -s "${PYTHON_BIN_PATH}" /usr/bin/python3
The issue is that by default /usr/bin is read only. I however circumvented it recently by following a few guides but it required turning off many security features like encryption and filevault. Then copying /usr/bin/python3 to /usr/bin/python made it finally work but it is quite a hassle.
hey @physxP Can you please provide links to the guides you used to make /usr/bin writable. Thanks!
hey @physxP Can you please provide links to the guides you used to make /usr/bin writable. Thanks!
As far as I remember no guide worked directly on Mac m1. I had to figure out equivalent commands on M1. I mostly entered the commands from the following script: https://github.com/fxgst/writeable_root/blob/main/writeable_root.c Also make sure to follow the prerequisites. I think the "sudo bless" command has to be changed to work on M1. Sorry I don't remember exact changes as it has been a while.