Repository navigation
Commit ca8f53f
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 (released October 22, 2026) 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". Most Core ML jobs in CI
hit this.
The coremltools 9.0 CMake build only needs numpy (it asks numpy for its
include path) and setuptools (it builds the bundled kmeans1d helper with
setup.py). Install just those, unpinned, so an existing numpy is left
alone. This also fixes a plain Python 3.12 venv, which has no setuptools:
there the old script stopped at the CMake configure step.
The comment next to COREMLTOOLS_VERSION now points at setup.py, where the
coremltools pin lives, and asks to re-check this package list on a bump.
Test plan:
- Python 3.12 venv with numpy 2.4.6, pandas 3.1.0 and setuptools, script
before and after this change. Before: mlmodel builds, numpy drops to
2.0.0, `import pandas` fails. After: mlmodel builds, numpy stays 2.4.6,
`import pandas` works.
- Brand new Python 3.12 venv with only pip, CMake 3.31: the script
installs numpy and setuptools, builds mlmodel and copies the protobuf
sources.
- Configuring coremltools with only numpy fails at kmeans1d, and with
only setuptools fails at the numpy include path, so both are needed.1 parent d533adf commit ca8f53f
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
0 commit comments