Skip to content

Commit 60f908a

Browse files
committed
Keep the caller's numpy when setting up the Core ML backend
backends/apple/coreml/scripts/install_requirements.sh clones coremltools and installs its reqs/build.pip before building the mlmodel library. That file pins numpy==2.0.0 for Python 3.9 to 3.12, so running the script silently downgrades numpy in the caller's environment. pandas 3.1.0 now requires numpy>=2.0.2, so after the downgrade `import pandas` fails, and anything that imports the ExecuTorch devtools (for example examples/apple/coreml/scripts/export.py) breaks with "Please upgrade numpy to >= 2.0.2". Every Core ML job in CI hits this. Configuring and building mlmodel only needs numpy (for its include path) and setuptools (to build the bundled kmeans1d helper). Install just those, unpinned, so an existing numpy is left alone. Test plan: in a fresh Python 3.12 venv with numpy 2.4.6 and pandas 3.1.0, ran the script before and after this change. - Before: mlmodel builds, numpy drops to 2.0.0, `import pandas` fails. - After: mlmodel builds, the protobuf sources are copied, numpy stays 2.4.6, `import pandas` works.
1 parent 6368414 commit 60f908a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ if [[ "$(uname)" == "Darwin" ]]; then
7575
fi
7676

7777
echo "${green}ExecuTorch: Installing coremltools dependencies.${reset}"
78+
# Configuring coremltools only needs numpy and setuptools. Its reqs/build.pip
79+
# pins an old numpy, which would downgrade numpy in the caller's environment.
7880
SDKROOT="$HOST_SDKROOT" \
7981
CC="$HOST_CC" \
8082
CXX="$HOST_CXX" \
8183
CFLAGS="$HOST_CFLAGS" \
8284
CXXFLAGS="$HOST_CXXFLAGS" \
83-
python -m pip install -r "$COREMLTOOLS_DIR_PATH/reqs/build.pip"
85+
python -m pip install numpy setuptools
8486
STATUS=$?
8587
if [ $STATUS -ne 0 ]; then
8688
echo "${red}ExecuTorch: Failed to install coremltools dependencies.${reset}"

0 commit comments

Comments
 (0)