Skip to content

Commit 7b3de0f

Browse files
aslonnieYoussefEssDS
authored andcommitted
[wheel] fix windows wheel building (ray-project#58343)
add `--use-pep517` flag; otherwise some part of the wheel building logic does not work on windows python 3.12 also removes the unnecessary "uninstall+reinstall" dance. the script only builds the wheel, it does not (and should not) install the wheel. Signed-off-by: Lonnie Liu <[email protected]>
1 parent 6b3db77 commit 7b3de0f

File tree

1 file changed

+18
-40
lines changed

1 file changed

+18
-40
lines changed

python/build-wheel-windows.sh

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -53,33 +53,15 @@ EOF
5353
source "$TEMP/refreshenv.sh"
5454
}
5555
56-
install_ray() {
57-
# TODO(mehrdadn): This function should be unified with the one in ci/ci.sh.
58-
(
59-
pip install wheel delvewheel
60-
61-
62-
pushd python/ray/dashboard/client
63-
choco install nodejs --version=22.4.1 -y
64-
refreshenv
65-
# https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
66-
export NODE_OPTIONS=--openssl-legacy-provider
67-
npm install
68-
npm run build
69-
popd
70-
71-
cd "${WORKSPACE_DIR}"/python
72-
pip install -v -e .
73-
)
74-
}
75-
76-
uninstall_ray() {
77-
pip uninstall -y ray
78-
79-
# Cleanup generated thirdparty files.
80-
python -c $'import shutil; import sys; \nfor d in sys.argv[1:]: shutil.rmtree(d, ignore_errors=True);' \
81-
"${ROOT_DIR}/ray/thirdparty_files" \
82-
"${ROOT_DIR}/ray/_private/runtime_env/agent/thirdparty_files"
56+
build_dashboard() {
57+
pushd python/ray/dashboard/client
58+
choco install nodejs --version=22.4.1 -y
59+
refreshenv
60+
# https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
61+
export NODE_OPTIONS=--openssl-legacy-provider
62+
npm install
63+
npm run build
64+
popd
8365
}
8466
8567
build_wheel_windows() {
@@ -88,9 +70,6 @@ build_wheel_windows() {
8870
exit 1
8971
fi
9072
91-
local ray_uninstall_status=0
92-
uninstall_ray || ray_uninstall_status=1
93-
9473
local local_dir="python/dist"
9574
{
9675
echo "build --announce_rc";
@@ -119,28 +98,27 @@ build_wheel_windows() {
11998
fi
12099
121100
unset PYTHON2_BIN_PATH PYTHON3_BIN_PATH # make sure these aren't set by some chance
122-
install_ray
101+
build_dashboard
102+
103+
python -m pip install pip==25.2
104+
python -m pip install wheel==0.45.1 delvewheel==1.11.2 setuptools==80.9.0
105+
123106
cd "${WORKSPACE_DIR}"/python
124107
# Set the commit SHA in _version.py.
125-
if [ -n "$BUILDKITE_COMMIT" ]; then
108+
if [[ -n "${BUILDKITE_COMMIT:-}" ]]; then
126109
sed -i.bak "s/{{RAY_COMMIT_SHA}}/$BUILDKITE_COMMIT/g" ray/_version.py && rm ray/_version.py.bak
127110
else
128111
echo "BUILDKITE_COMMIT variable not set - required to populated ray.__commit__."
129112
exit 1
130113
fi
114+
131115
# build ray wheel
132-
python -m pip wheel -v -w dist . --no-deps
116+
python -m pip wheel -v -w dist . --no-deps --use-pep517
133117
# Pack any needed system dlls like msvcp140.dll
134118
delvewheel repair dist/ray-*.whl
135119
# build ray-cpp wheel
136-
RAY_INSTALL_CPP=1 python -m pip wheel -v -w dist . --no-deps
137-
# No extra dlls are needed, do not call delvewheel
138-
uninstall_ray
120+
RAY_INSTALL_CPP=1 python -m pip wheel -v -w dist . --no-deps --use-pep517
139121
)
140-
141-
if [ 0 -eq "${ray_uninstall_status}" ]; then # If Ray was previously installed, restore it
142-
install_ray
143-
fi
144122
}
145123
146124
build_wheel_windows "$@"

0 commit comments

Comments
 (0)