Skip to content

Commit c017cf7

Browse files
authored
Fix PyTorch wheels build on Windows by installing libuv(missing build dependency) (#4596)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 21c232a commit c017cf7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/wheels-pytorch.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ jobs:
6969
.venv\Scripts\activate.ps1
7070
cd pytorch
7171
pip install cibuildwheel
72+
# Ref https://github.com/pytorch/pytorch/blob/8c2e45008282cf5202b72a0ecb0c2951438abeea/.ci/pytorch/windows/setup_build.bat#L23
73+
curl -k https://s3.amazonaws.com/ossci-windows/libuv-1.40.0-h8ffe710_0.tar.bz2 -o libuv-1.40.0-h8ffe710_0.tar.bz2
74+
mkdir libuv-1.40.0
75+
tar -xvjf libuv-1.40.0-h8ffe710_0.tar.bz2 -C libuv-1.40.0
76+
echo "libuv_ROOT=${{ env.NEW_WORKSPACE }}\pytorch\libuv-1.40.0" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
7277
7378
- name: Identify runtime dependencies
7479
run: |

scripts/install-pytorch.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@ function build_pytorch {
242242
pip install 'cmake<4.0.0'
243243
pip install -r requirements.txt
244244
pip install cmake ninja
245+
if [[ $OSTYPE = msys ]]; then
246+
# Another way (but we don't use conda): conda install -c conda-forge libuv=1.40.0
247+
# Ref https://github.com/pytorch/pytorch/blob/8c2e45008282cf5202b72a0ecb0c2951438abeea/.ci/pytorch/windows/setup_build.bat#L23
248+
# This is an artifact (around 330kb) that PyTorch uses, however it may not be very good to use here.
249+
# FIXME: Maybe better to build it ourselves, but for now it is used as a workaround.
250+
curl -k https://s3.amazonaws.com/ossci-windows/libuv-1.40.0-h8ffe710_0.tar.bz2 -o libuv-1.40.0-h8ffe710_0.tar.bz2
251+
mkdir libuv-1.40.0
252+
tar -xvjf libuv-1.40.0-h8ffe710_0.tar.bz2 -C libuv-1.40.0
253+
export libuv_ROOT="$PYTORCH_PROJ/libuv-1.40.0"
254+
fi
255+
245256
USE_XCCL=1 USE_STATIC_MKL=1 python setup.py bdist_wheel
246257
}
247258

0 commit comments

Comments
 (0)