diff --git a/.github/scripts/unittest.sh b/.github/scripts/unittest.sh index 43968762a8b..eecb3afb8e2 100755 --- a/.github/scripts/unittest.sh +++ b/.github/scripts/unittest.sh @@ -7,6 +7,11 @@ set -euo pipefail # Activate conda environment eval "$($(which conda) shell.bash hook)" && conda deactivate && conda activate ci +# Fix SSL certificate verification on Windows by using certifi's CA bundle +if [[ "$(uname)" == MSYS* ]]; then + export SSL_CERT_FILE=$(python -c "import certifi; print(certifi.where())") +fi + echo '::group::Install testing utilities' # TODO: remove the <8 constraint on pytest when https://github.com/pytorch/vision/issues/8238 is closed pip install --progress-bar=off "pytest<8" pytest-mock pytest-cov expecttest!=0.2.0 requests diff --git a/packaging/pre_build_script.sh b/packaging/pre_build_script.sh index b9046aa81c5..7f9e5c85c7c 100644 --- a/packaging/pre_build_script.sh +++ b/packaging/pre_build_script.sh @@ -38,5 +38,13 @@ else pip install "auditwheel<6.3.0" fi -pip install numpy pyyaml future ninja +pip install numpy pyyaml future pip install --upgrade setuptools==72.1.0 + +# Use conda ninja on Windows to avoid "ReadFile: The handle is invalid" errors +# with pip-installed ninja. On other platforms, pip ninja works fine. +if [[ "$OSTYPE" == "msys" ]]; then + conda install -y ninja +else + pip install ninja +fi diff --git a/packaging/windows/internal/vc_env_helper.bat b/packaging/windows/internal/vc_env_helper.bat index 1f50b1b05b5..09e8ebe7be8 100644 --- a/packaging/windows/internal/vc_env_helper.bat +++ b/packaging/windows/internal/vc_env_helper.bat @@ -24,6 +24,10 @@ if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat set DISTUTILS_USE_SDK=1 +REM Limit parallel jobs to avoid ninja "ReadFile: The handle is invalid" errors +REM See: https://github.com/pytorch/pytorch/issues/22450 +set MAX_JOBS=1 + set args=%1 shift :start