Windows CI: the `numpy<2.0.0` pin is reverted by `uv run pytest` and has had no effect since #6669
Motivation
.github/workflows/windows-tests.yml pins numpy below 2.0 before the tests, then starts them with plain uv run pytest:
# TODO(nabe): Remove the version constraint once Torch supports NumPy v2.0.0 for Windows.
uv pip uninstall numpy
uv pip install 'numpy<2.0.0'
...
uv run pytest -m "not slow" -n 8uv run syncs the project environment before it runs the command, and numpy is a base dependency, so it is put back to the locked 2.5.3 before pytest starts. The constraint has had no effect since #6669 replaced pytest with uv run pytest. The same PR added --no-sync to tests-with-minimum-versions.yml L77/L82, which is the guard this job is missing. The job's own report reads the other way: uv pip freeze prints numpy==1.26.4, and the test step then logs Uninstalled 1 package / Installed 1 package just before the first test line.
Reproduction (any platform, ~20 s, at 1819276):
$ uv sync --python 3.12
$ uv pip install 'numpy<2.0.0'
$ uv pip freeze | grep '^numpy'
numpy==1.26.4
$ uv run python -c "import numpy; print(numpy.__version__)"
Uninstalled 1 package in 32ms
Installed 1 package in 8ms
2.5.3On windows-latest I ran the job's install block verbatim: afterwards uv run --no-sync python -c ... prints 1.26.4 while plain uv run python -c ... prints 2.5.3, and the job's own command uv run pytest tests/test_distributions.py -q (99 passed) leaves numpy==2.5.3 in uv pip freeze (fork run, same result on a second attempt). The plotly<6.3.0 and kaleido<=0.1.0post1 pins are unaffected: they come from the optional extra, which uv run does not sync.
The same two lines appear in master runs 35159970840 (2026-09-16) and 29707713282 (2026-07-19). Nothing in the file's install or test lines has changed since #6669 merged on 2026-05-20 — only the permissions: block and the action SHA pinning.
Suggestion
- If the Windows suite should still run on numpy 1.x, add
--no-syncto both pytest steps, astests-with-minimum-versions.ymldoes. - If not, drop L50-L52 together with the TODO.
I would take 2: the job installs torch==2.14.0+cpu from the optional extra and has been passing with numpy 2.5.3 for four months, so the TODO's condition looks met in practice. 1 is the one-line change if you would rather keep the constraint.
Prepared with LLM assistance (Claude Opus 5); the commands and runs above were executed, not inferred.
Source: optuna/optuna