Skip to content

Commit eeb4271

Browse files
committed
[NumPy] use NumPy 2.x in CI
ghstack-source-id: daa4cbf Pull-Request: #158647
1 parent fe0ff12 commit eeb4271

File tree

21 files changed

+103
-115
lines changed

21 files changed

+103
-115
lines changed

.ci/aarch64_linux/aarch64_ci_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -eux -o pipefail
66

77
NUMPY_VERSION=2.0.2
88
if [[ "$DESIRED_PYTHON" == "3.13" || "$DESIRED_PYTHON" == "3.13t" ]]; then
9-
NUMPY_VERSION=2.1.2
9+
NUMPY_VERSION=2.1.3
1010
fi
1111

1212
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

.ci/docker/requirements-ci.txt

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,16 @@ ninja==1.11.1.3
110110
#Pinned versions: 1.11.1.3
111111
#test that import: run_test.py, test_cpp_extensions_aot.py,test_determination.py
112112

113-
numba==0.49.0 ; python_version < "3.9"
114-
numba==0.55.2 ; python_version == "3.9"
115-
numba==0.55.2 ; python_version == "3.10"
116-
numba==0.60.0 ; python_version == "3.12"
113+
numba==0.60.0; python_version < "3.13"
114+
numba==0.61.2; python_version >= "3.13"
117115
#Description: Just-In-Time Compiler for Numerical Functions
118-
#Pinned versions: 0.54.1, 0.49.0, <=0.49.1
116+
#Pinned versions: 0.60.0
119117
#test that import: test_numba_integration.py
120118
#For numba issue see https://github.com/pytorch/pytorch/issues/51511
121119

122120
#numpy
123121
#Description: Provides N-dimensional arrays and linear algebra
124-
#Pinned versions: 1.26.2
122+
#Pinned versions: 2.0.2
125123
#test that import: test_view_ops.py, test_unary_ufuncs.py, test_type_promotion.py,
126124
#test_type_info.py, test_torch.py, test_tensorexpr_pybind.py, test_tensorexpr.py,
127125
#test_tensorboard.py, test_tensor_creation_ops.py, test_static_runtime.py,
@@ -131,12 +129,10 @@ numba==0.60.0 ; python_version == "3.12"
131129
#test_nn.py, test_namedtensor.py, test_linalg.py, test_jit_cuda_fuser.py,
132130
#test_jit.py, test_indexing.py, test_datapipe.py, test_dataloader.py,
133131
#test_binary_ufuncs.py
134-
numpy==1.22.4; python_version == "3.9" or python_version == "3.10"
135-
numpy==1.26.2; python_version == "3.11" or python_version == "3.12"
136-
numpy==2.1.2; python_version >= "3.13"
132+
numpy==2.0.2; python_version < "3.13"
133+
numpy==2.1.3; python_version >= "3.13"
137134

138-
pandas==2.0.3; python_version < "3.13"
139-
pandas==2.2.3; python_version >= "3.13"
135+
pandas==2.2.3
140136

141137
#onnxruntime
142138
#Description: scoring engine for Open Neural Network Exchange (ONNX) models
@@ -247,11 +243,11 @@ scikit-image==0.22.0 ; python_version >= "3.10"
247243
#Pinned versions: 0.20.3
248244
#test that import:
249245

250-
scipy==1.10.1 ; python_version <= "3.11"
246+
scipy==1.13.1 ; python_version <= "3.11"
251247
scipy==1.14.1 ; python_version >= "3.12"
252248
# Pin SciPy because of failing distribution tests (see #60347)
253249
#Description: scientific python
254-
#Pinned versions: 1.10.1
250+
#Pinned versions: 1.13.1
255251
#test that import: test_unary_ufuncs.py, test_torch.py,test_tensor_creation_ops.py
256252
#test_spectral_ops.py, test_sparse_csr.py, test_reductions.py,test_nn.py
257253
#test_linalg.py, test_binary_ufuncs.py
@@ -312,17 +308,15 @@ z3-solver==4.15.1.0
312308
#Pinned versions:
313309
#test that import:
314310

315-
tensorboard==2.13.0 ; python_version < "3.13"
316-
tensorboard==2.18.0 ; python_version >= "3.13"
311+
tensorboard==2.20.0
317312
#Description: Also included in .ci/docker/requirements-docs.txt
318313
#Pinned versions:
319314
#test that import: test_tensorboard
320315

321-
pywavelets==1.4.1 ; python_version < "3.12"
322-
pywavelets==1.7.0 ; python_version >= "3.12"
316+
pywavelets==1.6.0 ; python_version == "3.9"
317+
pywavelets==1.7.0 ; python_version >= "3.10"
323318
#Description: This is a requirement of scikit-image, we need to pin
324-
# it here because 1.5.0 conflicts with numpy 1.21.2 used in CI
325-
#Pinned versions: 1.4.1
319+
#Pinned versions: 1.6.0
326320
#test that import:
327321

328322
lxml==5.3.0

.ci/docker/requirements-docs.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ matplotlib==3.6.3 ; python_version >= "3.13"
2424
#Description: This is used to generate PyTorch docs
2525
#Pinned versions: 3.6.3 if python > 3.12. Otherwise 3.5.3.
2626

27-
tensorboard==2.13.0 ; python_version < "3.13"
28-
tensorboard==2.18.0 ; python_version >= "3.13"
27+
tensorboard==2.20.0
2928
#Description: This is used to generate PyTorch docs
30-
#Pinned versions: 2.13.0
29+
#Pinned versions: 2.20.0
3130

3231
breathe==4.34.0
3332
#Description: This is used to generate PyTorch C++ docs

.ci/manywheel/build_common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ python setup.py clean
102102
retry pip install -qr requirements.txt
103103
case ${DESIRED_PYTHON} in
104104
cp31*)
105-
retry pip install -q --pre numpy==2.1.0
105+
retry pip install -q numpy==2.1.3
106106
;;
107107
# Should catch 3.9+
108108
*)
109-
retry pip install -q --pre numpy==2.0.2
109+
retry pip install -q numpy==2.0.2
110110
;;
111111
esac
112112

.ci/manywheel/build_libtorch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pushd "$PYTORCH_ROOT"
9595
retry pip install -qUr requirements-build.txt
9696
python setup.py clean
9797
retry pip install -qr requirements.txt
98-
retry pip install -q numpy==2.0.1
98+
retry pip install -q numpy==2.0.2
9999

100100
if [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
101101
echo "Calling build_amd.py at $(date)"

.ci/pytorch/run_tests.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fi
6868
NUMPY_PACKAGE=""
6969
if [[ ${py_ver} == "3.10" ]]; then
7070
PROTOBUF_PACKAGE="protobuf>=3.17.2"
71-
NUMPY_PACKAGE="numpy>=1.21.2"
71+
NUMPY_PACKAGE="numpy>=2.0"
7272
else
7373
PROTOBUF_PACKAGE="protobuf=3.14.0"
7474
fi
@@ -80,14 +80,7 @@ if [[ "$(uname)" == Darwin ]]; then
8080
retry pip install -q future hypothesis ${NUMPY_PACKAGE} ${PROTOBUF_PACKAGE} pytest
8181
else
8282
retry pip install -qr requirements.txt || true
83-
retry pip install -q hypothesis protobuf pytest || true
84-
numpy_ver=1.15
85-
case "$(python --version 2>&1)" in
86-
*2* | *3.5* | *3.6*)
87-
numpy_ver=1.11
88-
;;
89-
esac
90-
retry pip install -q "numpy==${numpy_ver}" || true
83+
retry pip install -q hypothesis ${NUMPY_PACKAGE} protobuf pytest || true
9184
fi
9285

9386
echo "Testing with:"

.ci/pytorch/test.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,9 +1611,9 @@ if [[ "${TEST_CONFIG}" == *numpy_2* ]]; then
16111611
# Force re-install of pandas to avoid error where pandas checks numpy version from initial install and fails upon import
16121612
TMP_PANDAS_VERSION=$(python -c "import pandas; print(pandas.__version__)" 2>/dev/null)
16131613
if [ -n "$TMP_PANDAS_VERSION" ]; then
1614-
python -m pip install --pre numpy==2.0.2 scipy==1.13.1 numba==0.60.0 pandas=="$TMP_PANDAS_VERSION" --force-reinstall
1614+
python -m pip install numpy==2.0.2 scipy==1.13.1 numba==0.60.0 pandas=="$TMP_PANDAS_VERSION" --force-reinstall
16151615
else
1616-
python -m pip install --pre numpy==2.0.2 scipy==1.13.1 numba==0.60.0
1616+
python -m pip install numpy==2.0.2 scipy==1.13.1 numba==0.60.0
16171617
fi
16181618
python test/run_test.py --include dynamo/test_functions.py dynamo/test_unspec.py test_binary_ufuncs.py test_fake_tensor.py test_linalg.py test_numpy_interop.py test_tensor_creation_ops.py test_torch.py torch_np/test_basic.py
16191619
elif [[ "${BUILD_ENVIRONMENT}" == *aarch64* && "${TEST_CONFIG}" != *perf_cpu_aarch64* ]]; then
@@ -1682,8 +1682,7 @@ elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
16821682
install_torchvision
16831683
install_torchao
16841684
id=$((SHARD_NUMBER-1))
1685-
# https://github.com/opencv/opencv-python/issues/885
1686-
pip_install opencv-python==4.8.0.74
1685+
pip_install opencv-python==4.12.0.88
16871686
if [[ "${TEST_CONFIG}" == *inductor_torchbench_smoketest_perf* ]]; then
16881687
checkout_install_torchbench hf_Bert hf_Albert timm_vision_transformer
16891688
PYTHONPATH=$(pwd)/torchbench test_inductor_torchbench_smoketest_perf

.ci/pytorch/win-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if [[ "$BUILD_ENVIRONMENT" == *cuda* ]]; then
3838
fi
3939

4040
# TODO: Move both of them to Windows AMI
41-
python -m pip install pytest-rerunfailures==10.3 pytest-cpp==2.3.0 tensorboard==2.13.0 protobuf==5.29.4 pytest-subtests==0.13.1
41+
python -m pip install pytest-rerunfailures==10.3 pytest-cpp==2.3.0 tensorboard==2.20.0 protobuf==5.29.4 pytest-subtests==0.13.1
4242

4343
# Install Z3 optional dependency for Windows builds.
4444
python -m pip install z3-solver==4.15.1.0

.ci/pytorch/windows/internal/smoke_test.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ echo "install wheel package"
3737

3838
call "internal\install_python.bat"
3939

40-
if "%DESIRED_PYTHON%" == "3.13t" %PYTHON_EXEC% -m pip install --pre numpy==2.2.1 protobuf
41-
if "%DESIRED_PYTHON%" == "3.13" %PYTHON_EXEC% -m pip install --pre numpy==2.1.2 protobuf
40+
if "%DESIRED_PYTHON%" == "3.13t" %PYTHON_EXEC% -m pip install --pre numpy==2.2.6 protobuf
41+
if "%DESIRED_PYTHON%" == "3.13" %PYTHON_EXEC% -m pip install --pre numpy==2.1.3 protobuf
4242
if "%DESIRED_PYTHON%" == "3.12" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf
4343
if "%DESIRED_PYTHON%" == "3.11" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf
4444
if "%DESIRED_PYTHON%" == "3.10" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf

.ci/pytorch/windows/setup_build.bat

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ call "internal\install_python.bat"
77

88
%PYTHON_EXEC% --version
99
set "PATH=%CD%\Python\Lib\site-packages\cmake\data\bin;%CD%\Python\Scripts;%CD%\Python;%PATH%"
10-
if "%DESIRED_PYTHON%" == "3.13t" %PYTHON_EXEC% -m pip install numpy==2.2.1 cmake
11-
if "%DESIRED_PYTHON%" == "3.13" %PYTHON_EXEC% -m pip install numpy==2.1.2 cmake
10+
11+
%PYTHON_EXEC% -m pip install "setuptools>=77.0.0" "packaging>=24.2"
12+
13+
if "%DESIRED_PYTHON%" == "3.13t" %PYTHON_EXEC% -m pip install numpy==2.2.6 cmake
14+
if "%DESIRED_PYTHON%" == "3.13" %PYTHON_EXEC% -m pip install numpy==2.1.3 cmake
1215
if "%DESIRED_PYTHON%" == "3.12" %PYTHON_EXEC% -m pip install numpy==2.0.2 cmake
1316
if "%DESIRED_PYTHON%" == "3.11" %PYTHON_EXEC% -m pip install numpy==2.0.2 cmake
1417
if "%DESIRED_PYTHON%" == "3.10" %PYTHON_EXEC% -m pip install numpy==2.0.2 cmake

0 commit comments

Comments
 (0)