Chang how numpy version is handled. (#8130)

Numpy has binary compatibility, which means "binaries compiled against a given version of NumPy will still run correctly with newer NumPy versions, but not with older versions." So, if an onnx runtime package was built with numpy version A, then at run time it requires numpy version >=A. In this change, we read numpy version from the installed packages at build time, to avoid manually keeping the build time/runtime consistency.
This commit is contained in:
Changming Sun 2021-06-23 14:08:37 -07:00 committed by GitHub
parent db88f3059c
commit 1fa6986656
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View file

@ -1372,6 +1372,14 @@ if (onnxruntime_USE_VITISAI)
endif()
configure_file(onnxruntime_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime_config.h)
if(WIN32)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/Debug/requirements.txt)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/Release/requirements.txt)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/requirements.txt)
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/MinSizeRel/requirements.txt)
else()
configure_file(../requirements.txt.in ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt)
endif()
if (onnxruntime_USE_CUDA)
#The following 6 lines are copied from https://gitlab.kitware.com/cmake/cmake/issues/17559

View file

@ -1,3 +0,0 @@
numpy >= 1.16.6
protobuf
flatbuffers

3
requirements.txt.in Normal file
View file

@ -0,0 +1,3 @@
numpy >= @Python_NumPy_VERSION@
protobuf
flatbuffers

View file

@ -396,14 +396,6 @@ with open(requirements_path) as f:
install_requires = f.read().splitlines()
if is_manylinux:
AUDITWHEEL_PLAT = environ.get('AUDITWHEEL_PLAT', None)
if AUDITWHEEL_PLAT == 'manylinux2014_aarch64':
for i in range(len(install_requires)):
req = install_requires[i]
if req.startswith("numpy"):
install_requires[i] = "numpy >= 1.19.5"
if enable_training:
def save_build_and_package_info(package_name, version_number, cuda_version):