Update python package pipeline to support 3.11 (#15311)

### Description
Update python package pipeline to support 3.11

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
This commit is contained in:
Jian Chen 2023-04-04 10:55:32 -07:00 committed by GitHub
parent 0412bffbb4
commit af28754e6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 83 additions and 26 deletions

View file

@ -152,10 +152,16 @@ stages:
filename: 'C:\Program Files\Intel\openvino_2021.4.752\bin\setupvars.bat'
modifyEnvironment: true
- script: |
python -m pip install -q setuptools wheel numpy==1.21.6
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- task: PythonScript@0
inputs:
scriptSource: inline
script: |
import sys
np_version = 'numpy==1.21.6' if sys.version_info < (3, 11) else 'numpy==1.24.2'
import subprocess
subprocess.call(['pip', 'install', '-q', 'setuptools', 'wheel', np_version])
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- task: PowerShell@2
displayName: 'Install ONNX'
@ -412,10 +418,16 @@ stages:
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- script: |
python -m pip install -q setuptools wheel numpy==1.21.6
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- task: PythonScript@0
inputs:
scriptSource: inline
script: |
import sys
np_version = 'numpy==1.21.6' if sys.version_info < (3, 11) else 'numpy==1.24.2'
import subprocess
subprocess.call(['pip', 'install', '-q', 'setuptools', 'wheel', np_version])
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- task: PowerShell@2
displayName: 'Install ONNX'

View file

@ -67,6 +67,10 @@ stages:
PythonVersion: '3.10'
MsbuildPlatform: x64
buildArch: x64
Python311_x64:
PythonVersion: '3.11'
MsbuildPlatform: x64
buildArch: x64
# Training build cannot support Win32 for now because one or more of its python
# dependencies does not support Win32. So, don't build a training package for Win32
${{ if not(contains(parameters.build_py_parameters, '--enable_training')) }}:
@ -82,6 +86,10 @@ stages:
PythonVersion: '3.10'
MsbuildPlatform: Win32
buildArch: x86
Python311_x86:
PythonVersion: '3.11'
MsbuildPlatform: Win32
buildArch: x86
variables:
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
EnvSetupScript: setup_env.bat
@ -119,10 +127,16 @@ stages:
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- script: |
python -m pip install -q setuptools wheel numpy==1.21.6
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- task: PythonScript@0
inputs:
scriptSource: inline
script: |
import sys
np_version = 'numpy==1.21.6' if sys.version_info < (3, 11) else 'numpy==1.24.2'
import subprocess
subprocess.call(['pip', 'install', '-q', 'setuptools', 'wheel', np_version])
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- template: download-deps.yml
@ -278,6 +292,14 @@ stages:
ENV_SETUP_SCRIPT: setup_env_gpu.bat
EP_NAME: gpu
- template: py-win-gpu.yml
parameters:
MACHINE_POOL: 'onnxruntime-gpu-winbuild-t4'
PYTHON_VERSION: '3.11'
EP_BUILD_FLAGS: --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.5.1.7.Windows10.x86_64.cuda-11.8.cudnn8.6" --cuda_version=11.6 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6" --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=52;60;61;70;75;80"
ENV_SETUP_SCRIPT: setup_env_gpu.bat
EP_NAME: gpu
- template: py-win-gpu.yml
parameters:
MACHINE_POOL: 'aiinfra-dml-winbuild'
@ -302,6 +324,14 @@ stages:
ENV_SETUP_SCRIPT: setup_env.bat
EP_NAME: directml
- template: py-win-gpu.yml
parameters:
MACHINE_POOL: 'aiinfra-dml-winbuild'
PYTHON_VERSION: '3.11'
EP_BUILD_FLAGS: --use_dml --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 --enable_wcos
ENV_SETUP_SCRIPT: setup_env.bat
EP_NAME: directml
- ${{ if eq(parameters.enable_mac_cpu, true) }}:
- job: MacOS_py_Wheels
timeoutInMinutes: 90
@ -319,6 +349,8 @@ stages:
PythonVersion: '3.9'
Python310:
PythonVersion: '3.10'
Python311:
PythonVersion: '3.11'
steps:
- checkout: self
clean: true
@ -381,6 +413,8 @@ stages:
PythonVersion: '3.9'
Python310:
PythonVersion: '3.10'
Python311:
PythonVersion: '3.11'
steps:
- checkout: self
clean: true

View file

@ -47,10 +47,16 @@ jobs:
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- script: |
python -m pip install -q setuptools wheel numpy==1.21.6
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- task: PythonScript@0
inputs:
scriptSource: inline
script: |
import sys
np_version = 'numpy==1.21.6' if sys.version_info < (3, 11) else 'numpy==1.24.2'
import subprocess
subprocess.call(['pip', 'install', '-q', 'setuptools', 'wheel', np_version])
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- template: download-deps.yml

View file

@ -7,7 +7,7 @@ CXXFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-st
BUILD_DEVICE="CPU"
BUILD_CONFIG="Release"
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11")
while getopts "d:p:" parameter_Option
do case "${parameter_Option}"
in

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -e -x
pushd .
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11")
CURRENT_DIR=$(pwd)
if ! [ -x "$(command -v protoc)" ]; then
$CURRENT_DIR/install_protobuf.sh

View file

@ -1,4 +1,5 @@
numpy==1.21.6
numpy==1.21.6 ; python_version < '3.11'
numpy==1.24.2 ; python_version >= '3.11'
mypy
pytest
setuptools>=41.4.0

View file

@ -14,7 +14,7 @@ else
fi
if [ ! -d "/opt/conda/bin" ]; then
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11")
else
PYTHON_EXES=("/opt/conda/bin/python")
fi

View file

@ -6,7 +6,7 @@ yum -y install \
graphviz
if [ ! -d "/opt/conda/bin" ]; then
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11")
else
PYTHON_EXES=("/opt/conda/bin/python")
fi

View file

@ -6,7 +6,7 @@ yum -y install \
graphviz
if [ ! -d "/opt/conda/bin" ]; then
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11")
else
PYTHON_EXES=("/opt/conda/bin/python")
fi

View file

@ -1,4 +1,5 @@
numpy==1.21.6
numpy==1.21.6 ; python_version < '3.11'
numpy==1.24.2 ; python_version >= '3.11'
mypy
pytest
setuptools>=41.4.0

View file

@ -1,5 +1,6 @@
cerberus
numpy==1.21.6
numpy==1.21.6 ; python_version < '3.11'
numpy==1.24.2 ; python_version >= '3.11'
mypy
pytest
setuptools>=41.4.0

View file

@ -1 +1,2 @@
numpy==1.21.6
numpy==1.21.6 ; python_version < '3.11'
numpy==1.24.2 ; python_version >= '3.11'

View file

@ -1,6 +1,7 @@
pandas
scikit-learn
numpy==1.21.6
numpy==1.21.6 ; python_version < '3.11'
numpy==1.24.2 ; python_version >= '3.11'
transformers==v4.4.2
rsa==4.9
tensorboard>=2.2.0,<2.5.0