[ORT 1.18.1 Release] Update ORT numpy dependency to >=1.21.6,<2.0 (#21141)

### Description
Updates the version of numpy required by onnxruntime to >=1.21.6,<2.0



### Motivation and Context
Numpy released version 2.0. The onnxruntime 1.18.1 release is using
numpy < 2.0, so we need to update requirement files to only install
versions between 1.21.6 and 2.0 (non-inclusive).
This commit is contained in:
Adrian Lizarraga 2024-06-24 11:24:55 -07:00 committed by GitHub
parent d0aee204af
commit 387127404e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 17 additions and 14 deletions

View file

@ -1390,14 +1390,6 @@ string(APPEND ORT_BUILD_INFO "build type=${CMAKE_BUILD_TYPE}")
string(APPEND ORT_BUILD_INFO ", cmake cxx flags: ${CMAKE_CXX_FLAGS}")
configure_file(onnxruntime_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime_config.h)
get_property(onnxruntime_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (onnxruntime_GENERATOR_IS_MULTI_CONFIG)
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)
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)

View file

@ -565,6 +565,9 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy
${ONNXRUNTIME_ROOT}/__init__.py
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
COMMAND ${CMAKE_COMMAND} -E copy
${REPO_ROOT}/requirements.txt
$<TARGET_FILE_DIR:${build_output_target}>
COMMAND ${CMAKE_COMMAND} -E copy
${REPO_ROOT}/ThirdPartyNotices.txt
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/

View file

@ -1,7 +1,8 @@
optimum>=1.14.1
transformers>=4.33.2,<= 4.37.2
torch>=2.2.0
numpy>=1.21.6,<2.0
onnx==1.16.0
datasets>=2.8.0
protobuf==3.20.2
psutil
psutil

View file

@ -1,3 +1,4 @@
numpy>=1.21.6,<2.0
onnx==1.16.0
transformers>=4.36.2
onnxscript>=0.1.0.dev20240126

View file

@ -1,2 +1,3 @@
numpy>=1.21.6,<2.0
onnx==1.16.0
pytest

View file

@ -1,6 +1,6 @@
coloredlogs
flatbuffers
numpy >= @Python_NumPy_VERSION@
numpy>=1.21.6,<2.0
packaging
protobuf
sympy

View file

@ -74,7 +74,7 @@ steps:
workingFolder: '$(Build.BinariesDirectory)'
- script: |
python -m pip install --upgrade "setuptools>=68.2.2" wheel numpy flatbuffers
python -m pip install --upgrade "setuptools>=68.2.2" wheel "numpy>=1.21.6,<2.0" flatbuffers
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'

View file

@ -80,4 +80,4 @@ RUN ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ${CONDA_ENVIRONMENT_PATH}/bi
# Install migraphx
RUN apt update && apt install -y migraphx
RUN pip install numpy packaging ml_dtypes==0.3.0
RUN pip install "numpy>=1.21.6,<2.0" packaging ml_dtypes==0.3.0

View file

@ -2,7 +2,7 @@
pip3 install --user --upgrade pip
pip3 install --user numpy==1.19.0 torch pytest
pip3 install --user "numpy>=1.21.6,<2.0" torch pytest
pip3 install --user /build/Release/dist/*.whl
export PYTHONPATH=/onnxruntime_src/tools:/usr/local/lib/python3.8/site-packages:$PYTHONPATH

View file

@ -637,7 +637,12 @@ function Install-ONNX {
}
Write-Host "Installing python packages..."
[string[]]$pip_args = "-m", "pip", "install", "-qq", "--disable-pip-version-check", "setuptools>=68.2.2", "wheel", "numpy", "protobuf==$protobuf_version"
# Get the required numpy version from onnxruntime's requirements.txt (e.g., numpy>=1.21.6,<2.0)
$numpy_req_match_info = Get-Content "$src_root\requirements.txt" | Select-String -pattern 'numpy'
$numpy_to_install = $numpy_req_match_info.ToString()
[string[]]$pip_args = "-m", "pip", "install", "-qq", "--disable-pip-version-check", "setuptools>=68.2.2", "wheel", "$numpy_to_install", "protobuf==$protobuf_version"
&"python.exe" $pip_args
if ($lastExitCode -ne 0) {
exit $lastExitCode