From 8233f19b6023c71f92d7aa768fbbb9e95eea065a Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Tue, 19 Mar 2024 18:20:16 -0400 Subject: [PATCH 1/3] Update wheel build numpy to 2.0 (#1746) * Update wheel build numpy to 2.0 * aarch64 --- aarch64_linux/aarch64_ci_setup.sh | 6 +++--- manywheel/build_common.sh | 8 ++++---- wheel/build_wheel.sh | 15 ++++++++++----- windows/internal/smoke_test.bat | 8 +++++++- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/aarch64_linux/aarch64_ci_setup.sh b/aarch64_linux/aarch64_ci_setup.sh index 07a4757ff..f6f07a6f3 100755 --- a/aarch64_linux/aarch64_ci_setup.sh +++ b/aarch64_linux/aarch64_ci_setup.sh @@ -26,11 +26,11 @@ conda create -y -c conda-forge -n "${CONDA_ENV_NAME}" python=${DESIRED_PYTHON} conda activate "${CONDA_ENV_NAME}" if [[ "$DESIRED_PYTHON" == "3.8" ]]; then - NUMPY_VERSION="1.24.4" + pip install -q numpy==1.24.4 else - NUMPY_VERSION="1.26.2" + pip install -q --pre numpy==2.0.0b1 fi -conda install -y -c conda-forge numpy==${NUMPY_VERSION} pyyaml==6.0.1 patchelf==0.17.2 pygit2==1.13.2 openblas==0.3.25=*openmp* ninja==1.11.1 scons==4.5.2 +conda install -y -c conda-forge pyyaml==6.0.1 patchelf==0.17.2 pygit2==1.13.2 openblas==0.3.25=*openmp* ninja==1.11.1 scons==4.5.2 python --version conda --version diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index 60f8221d5..be6dba135 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -115,17 +115,17 @@ case ${DESIRED_PYTHON} in retry pip install -q numpy==1.15 ;; cp310*) - retry pip install -q numpy==1.21.2 + retry pip install -q --pre numpy==2.0.0b1 ;; cp311*) - retry pip install -q numpy==1.23.1 + retry pip install -q --pre numpy==2.0.0b1 ;; cp312*) - retry pip install -q numpy==1.26.1 + retry pip install -q --pre numpy==2.0.0b1 ;; # Should catch 3.9+ *) - retry pip install -q numpy==1.19.4 + retry retry pip install -q --pre numpy==2.0.0b1 ;; esac diff --git a/wheel/build_wheel.sh b/wheel/build_wheel.sh index b509fb7a9..4abf38a59 100755 --- a/wheel/build_wheel.sh +++ b/wheel/build_wheel.sh @@ -136,25 +136,25 @@ case $desired_python in echo "Using 3.12 deps" SETUPTOOLS_PINNED_VERSION=">=68.0.0" PYYAML_PINNED_VERSION=">=6.0.1" - NUMPY_PINNED_VERSION="==1.26.0" + NUMPY_PINNED_VERSION="=2.0.0b1" ;; 3.11) echo "Using 3.11 deps" SETUPTOOLS_PINNED_VERSION=">=46.0.0" PYYAML_PINNED_VERSION=">=5.3" - NUMPY_PINNED_VERSION="==1.23.5" + NUMPY_PINNED_VERSION="=2.0.0b1" ;; 3.10) echo "Using 3.10 deps" SETUPTOOLS_PINNED_VERSION=">=46.0.0" PYYAML_PINNED_VERSION=">=5.3" - NUMPY_PINNED_VERSION="=1.21.2" + NUMPY_PINNED_VERSION="=2.0.0b1" ;; 3.9) echo "Using 3.9 deps" SETUPTOOLS_PINNED_VERSION=">=46.0.0" PYYAML_PINNED_VERSION=">=5.3" - NUMPY_PINNED_VERSION="=1.19" + NUMPY_PINNED_VERSION="=2.0.0b1" ;; 3.8) echo "Using 3.8 deps" @@ -173,7 +173,12 @@ tmp_env_name="wheel_py$python_nodot" conda create ${EXTRA_CONDA_INSTALL_FLAGS} -yn "$tmp_env_name" python="$desired_python" source activate "$tmp_env_name" -retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq "numpy${NUMPY_PINNED_VERSION}" nomkl cmake ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" typing_extensions requests +if[[ $desired_python != "3.8" ]]; then + pip install -q --pre numpy=${NUMPY_PINNED_VERSION} +else + retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq "numpy${NUMPY_PINNED_VERSION}" +fi +retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq nomkl cmake ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" typing_extensions requests retry pip install -qr "${pytorch_rootdir}/requirements.txt" || true # For USE_DISTRIBUTED=1 on macOS, need libuv and pkg-config to find libuv. diff --git a/windows/internal/smoke_test.bat b/windows/internal/smoke_test.bat index b6200d751..1a5b9e02c 100644 --- a/windows/internal/smoke_test.bat +++ b/windows/internal/smoke_test.bat @@ -52,7 +52,13 @@ if errorlevel 1 exit /b 1 set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python;%PATH%" -pip install -q numpy protobuf + +if "%DESIRED_PYTHON%" == "3.12" pip install -q --pre numpy==2.0.0b1 protobuf +if "%DESIRED_PYTHON%" == "3.11" pip install -q --pre numpy==2.0.0b1 protobuf +if "%DESIRED_PYTHON%" == "3.10" pip install -q --pre numpy==2.0.0b1 protobuf +if "%DESIRED_PYTHON%" == "3.9" pip install -q --pre numpy==2.0.0b1 protobuf +if "%DESIRED_PYTHON%" == "3.8" pip install -q numpy protobuf + if errorlevel 1 exit /b 1 for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i" From 5a36696ffaa37a8f9b5e7d75d310f1b98b8e7b8c Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 20 Mar 2024 10:25:49 -0400 Subject: [PATCH 2/3] Update build_wheel.sh --- wheel/build_wheel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wheel/build_wheel.sh b/wheel/build_wheel.sh index 4abf38a59..57c6418b4 100755 --- a/wheel/build_wheel.sh +++ b/wheel/build_wheel.sh @@ -173,7 +173,7 @@ tmp_env_name="wheel_py$python_nodot" conda create ${EXTRA_CONDA_INSTALL_FLAGS} -yn "$tmp_env_name" python="$desired_python" source activate "$tmp_env_name" -if[[ $desired_python != "3.8" ]]; then +if [[ $desired_python != "3.8" ]]; then pip install -q --pre numpy=${NUMPY_PINNED_VERSION} else retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq "numpy${NUMPY_PINNED_VERSION}" From 3d20d3b5202a4633ef4ef4b1aa917ede43a960cc Mon Sep 17 00:00:00 2001 From: atalman Date: Wed, 20 Mar 2024 12:14:00 -0700 Subject: [PATCH 3/3] Simplify --- manywheel/build_common.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index be6dba135..bd825dc63 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -114,18 +114,12 @@ case ${DESIRED_PYTHON} in cp38*) retry pip install -q numpy==1.15 ;; - cp310*) - retry pip install -q --pre numpy==2.0.0b1 - ;; - cp311*) - retry pip install -q --pre numpy==2.0.0b1 - ;; - cp312*) + cp31*) retry pip install -q --pre numpy==2.0.0b1 ;; # Should catch 3.9+ *) - retry retry pip install -q --pre numpy==2.0.0b1 + retry pip install -q --pre numpy==2.0.0b1 ;; esac