Skip to content

Commit 91de294

Browse files
committed
[NumPy] use NumPy 2.x in CI
ghstack-source-id: bdb0b1c Pull-Request: #158647
1 parent a4ec381 commit 91de294

File tree

17 files changed

+45
-98
lines changed

17 files changed

+45
-98
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: 11 additions & 15 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.0; 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,9 +129,8 @@ 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

138135
pandas==2.0.3; python_version < "3.13"
139136
pandas==2.2.3; python_version >= "3.13"
@@ -247,11 +244,11 @@ scikit-image==0.22.0 ; python_version >= "3.10"
247244
#Pinned versions: 0.20.3
248245
#test that import:
249246

250-
scipy==1.10.1 ; python_version <= "3.11"
247+
scipy==1.13.1 ; python_version <= "3.11"
251248
scipy==1.14.1 ; python_version >= "3.12"
252249
# Pin SciPy because of failing distribution tests (see #60347)
253250
#Description: scientific python
254-
#Pinned versions: 1.10.1
251+
#Pinned versions: 1.13.1
255252
#test that import: test_unary_ufuncs.py, test_torch.py,test_tensor_creation_ops.py
256253
#test_spectral_ops.py, test_sparse_csr.py, test_reductions.py,test_nn.py
257254
#test_linalg.py, test_binary_ufuncs.py
@@ -318,11 +315,10 @@ tensorboard==2.18.0 ; python_version >= "3.13"
318315
#Pinned versions:
319316
#test that import: test_tensorboard
320317

321-
pywavelets==1.4.1 ; python_version < "3.12"
322-
pywavelets==1.7.0 ; python_version >= "3.12"
318+
pywavelets==1.6.0 ; python_version == "3.9"
319+
pywavelets==1.7.0 ; python_version >= "3.10"
323320
#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
321+
#Pinned versions: 1.6.0
326322
#test that import:
327323

328324
lxml==5.3.0

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,9 +1609,9 @@ if [[ "${TEST_CONFIG}" == *numpy_2* ]]; then
16091609
# Force re-install of pandas to avoid error where pandas checks numpy version from initial install and fails upon import
16101610
TMP_PANDAS_VERSION=$(python -c "import pandas; print(pandas.__version__)" 2>/dev/null)
16111611
if [ -n "$TMP_PANDAS_VERSION" ]; then
1612-
python -m pip install --pre numpy==2.0.2 scipy==1.13.1 numba==0.60.0 pandas=="$TMP_PANDAS_VERSION" --force-reinstall
1612+
python -m pip install numpy==2.0.2 scipy==1.13.1 numba==0.60.0 pandas=="$TMP_PANDAS_VERSION" --force-reinstall
16131613
else
1614-
python -m pip install --pre numpy==2.0.2 scipy==1.13.1 numba==0.60.0
1614+
python -m pip install numpy==2.0.2 scipy==1.13.1 numba==0.60.0
16151615
fi
16161616
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
16171617
elif [[ "${BUILD_ENVIRONMENT}" == *aarch64* && "${TEST_CONFIG}" != *perf_cpu_aarch64* ]]; then

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set "PATH=%CD%\Python\Lib\site-packages\cmake\data\bin;%CD%\Python\Scripts;%CD%\
1010

1111
%PYTHON_EXEC% -m pip install "setuptools>=77.0.0" "packaging>=24.2"
1212

13-
if "%DESIRED_PYTHON%" == "3.13t" %PYTHON_EXEC% -m pip install numpy==2.2.1 cmake
14-
if "%DESIRED_PYTHON%" == "3.13" %PYTHON_EXEC% -m pip install numpy==2.1.2 cmake
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
1515
if "%DESIRED_PYTHON%" == "3.12" %PYTHON_EXEC% -m pip install numpy==2.0.2 cmake
1616
if "%DESIRED_PYTHON%" == "3.11" %PYTHON_EXEC% -m pip install numpy==2.0.2 cmake
1717
if "%DESIRED_PYTHON%" == "3.10" %PYTHON_EXEC% -m pip install numpy==2.0.2 cmake

.ci/wheel/build_wheel.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ case $desired_python in
137137
echo "Using 3.13 deps"
138138
SETUPTOOLS_PINNED_VERSION=">=77.0.0"
139139
PYYAML_PINNED_VERSION=">=6.0.1"
140-
NUMPY_PINNED_VERSION="=2.1.0"
140+
NUMPY_PINNED_VERSION="==2.1.0"
141141
CONDA_ENV_CREATE_FLAGS="python-freethreading"
142142
EXTRA_CONDA_INSTALL_FLAGS="-c conda-forge"
143143
desired_python="3.13"
@@ -147,35 +147,35 @@ case $desired_python in
147147
echo "Using 3.13 deps"
148148
SETUPTOOLS_PINNED_VERSION=">=77.0.0"
149149
PYYAML_PINNED_VERSION=">=6.0.1"
150-
NUMPY_PINNED_VERSION="=2.1.0"
150+
NUMPY_PINNED_VERSION="==2.1.0"
151151
;;
152152
3.12)
153153
echo "Using 3.12 deps"
154154
SETUPTOOLS_PINNED_VERSION=">=77.0.0"
155155
PYYAML_PINNED_VERSION=">=6.0.1"
156-
NUMPY_PINNED_VERSION="=2.0.2"
156+
NUMPY_PINNED_VERSION="==2.0.2"
157157
;;
158158
3.11)
159159
echo "Using 3.11 deps"
160160
SETUPTOOLS_PINNED_VERSION=">=77.0.0"
161161
PYYAML_PINNED_VERSION=">=5.3"
162-
NUMPY_PINNED_VERSION="=2.0.2"
162+
NUMPY_PINNED_VERSION="==2.0.2"
163163
;;
164164
3.10)
165165
echo "Using 3.10 deps"
166166
SETUPTOOLS_PINNED_VERSION=">=77.0.0"
167167
PYYAML_PINNED_VERSION=">=5.3"
168-
NUMPY_PINNED_VERSION="=2.0.2"
168+
NUMPY_PINNED_VERSION="==2.0.2"
169169
;;
170170
3.9)
171171
echo "Using 3.9 deps"
172172
SETUPTOOLS_PINNED_VERSION=">=77.0.0"
173173
PYYAML_PINNED_VERSION=">=5.3"
174-
NUMPY_PINNED_VERSION="=2.0.2"
174+
NUMPY_PINNED_VERSION="==2.0.2"
175175
;;
176176
*)
177177
echo "Using default deps"
178-
NUMPY_PINNED_VERSION="=1.11.3"
178+
NUMPY_PINNED_VERSION="==2.0.2"
179179
;;
180180
esac
181181

@@ -185,7 +185,7 @@ conda create ${EXTRA_CONDA_INSTALL_FLAGS} -yn "$tmp_env_name" python="$desired_p
185185
source activate "$tmp_env_name"
186186

187187
retry pip install -r "${pytorch_rootdir}/requirements-build.txt"
188-
pip install "numpy=${NUMPY_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" requests ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" typing-extensions
188+
pip install "numpy${NUMPY_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" requests ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" typing-extensions
189189
retry pip install -r "${pytorch_rootdir}/requirements.txt" || true
190190
retry brew install libomp
191191

.circleci/scripts/binary_linux_test.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,13 @@ if [[ "$PACKAGE_TYPE" != libtorch ]]; then
3232
fi
3333
3434
EXTRA_CONDA_FLAGS=""
35-
NUMPY_PIN=""
35+
NUMPY_PIN=">=2.0.2"
3636
PROTOBUF_PACKAGE="defaults::protobuf"
3737
3838
if [[ "\$python_nodot" = *310* ]]; then
39-
# There's an issue with conda channel priority where it'll randomly pick 1.19 over 1.20
40-
# we set a lower boundary here just to be safe
41-
NUMPY_PIN=">=1.21.2"
4239
PROTOBUF_PACKAGE="protobuf>=3.19.0"
4340
fi
4441
45-
if [[ "\$python_nodot" = *39* ]]; then
46-
# There's an issue with conda channel priority where it'll randomly pick 1.19 over 1.20
47-
# we set a lower boundary here just to be safe
48-
NUMPY_PIN=">=1.20"
49-
fi
50-
5142
# Move debug wheels out of the package dir so they don't get installed
5243
mkdir -p /tmp/debug_final_pkgs
5344
mv /final_pkgs/debug-*.zip /tmp/debug_final_pkgs || echo "no debug packages to move"

0 commit comments

Comments
 (0)