Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(python): add compatibility with NumPy 2 (tensorflow#2733)
Upgrade the pinned packages used in the Bazel build environment to make the Python extension module compatible with NumPy 2 in addition to NumPy 1. Modules built against NumPy 1 are not compatible with runtime environments that use NumPy 2, but modules built against NumPy 2 should be compatible with both. The python_requirements.txt defining the Bazel build environment is was upgraded via the command: bazel run //third_party:python_requirements.update -- --upgrade See third_party/python_requirements.in for details. This change upgraded a number of other packages as well, notably Tensorflow, from 2.17 to 2.18. In fact, Tensorflow 2.18 is also required for compatibility with NumPy 2. Also update the path to the header files within the NumPy wheel, used by the :numpy_cc_deps target. Our method of including header files shipped in Python packages is sensitive to the internal details of those packages, and NumPy moved their headers during this major version change. This fixes tensorflow#2731, in which //python/tflite_micro:whl_test began failing. :whl_test installs the newly built tflite_micro package, which packages our Python extension module, and its dependencies into a clean virtual environment and performs tests. The tflite_micro package has unversioned dependencies on the tensorflow and numpy packages. Within the last 24 hours, tensorflow in PyPI was upgraded from 2.17 to 2.18. The 2.18 release upgraded tensorflow's versioned dependency on numpy from 1 to 2, forcing the environment created by :whl_test to use NumPy 2 instead of NumPy 1; thereby exposing the incompatibility of the extension module that was built against NumPy 1, and causing :whl_test to fail. BUG=tensorflow#2731
- Loading branch information