Skip to content

Commit

Permalink
Chang how numpy version is handled. (#8130)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
snnn committed Jun 23, 2021
1 parent db88f30 commit 1fa6986
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 8 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

3 changes: 3 additions & 0 deletions requirements.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy >= @Python_NumPy_VERSION@
protobuf
flatbuffers
8 changes: 0 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,6 @@ def run(self):
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):

Expand Down

0 comments on commit 1fa6986

Please sign in to comment.