Skip to content

Commit

Permalink
Remove numpy for Ray wheel build (ray-project#40603)
Browse files Browse the repository at this point in the history
I don't think this is actually needed any more since Ray doesn't depend on numpy any more (it used to be that some of Ray's serialization code did, but that's not the case any more).

Follow up from ray-project#40399

Signed-off-by: Philipp Moritz <pcmoritz@gmail.com>
  • Loading branch information
pcmoritz authored and vickytsang committed Jan 12, 2024
1 parent 2f2a27e commit 9cddc36
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
5 changes: 1 addition & 4 deletions ci/build/build-manylinux-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
set -exuo pipefail

PYTHON="$1"
NUMPY_VERSION="$2"
TRAVIS_COMMIT="${TRAVIS_COMMIT:-$BUILDKITE_COMMIT}"

mkdir -p .whl
cd python
# Fix the numpy version because this will be the oldest numpy version we can
# support.
/opt/python/"${PYTHON}"/bin/pip install -q numpy=="${NUMPY_VERSION}" cython==0.29.32
/opt/python/"${PYTHON}"/bin/pip install -q cython==0.29.32
# Set the commit SHA in _version.py.
if [[ -n "$TRAVIS_COMMIT" ]]; then
sed -i.bak "s/{{RAY_COMMIT_SHA}}/$TRAVIS_COMMIT/g" ray/_version.py && rm ray/_version.py.bak
Expand Down
12 changes: 5 additions & 7 deletions ci/ray_ci/builder_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class PythonVersionInfo(TypedDict):
bin_path: str
numpy_version: str


BUILD_TYPES = [
Expand All @@ -18,10 +17,10 @@ class PythonVersionInfo(TypedDict):
"aarch64",
]
PYTHON_VERSIONS = {
"3.8": PythonVersionInfo(bin_path="cp38-cp38", numpy_version="1.19.3"),
"3.9": PythonVersionInfo(bin_path="cp39-cp39", numpy_version="1.19.3"),
"3.10": PythonVersionInfo(bin_path="cp310-cp310", numpy_version="1.22.0"),
"3.11": PythonVersionInfo(bin_path="cp311-cp311", numpy_version="1.22.0"),
"3.8": PythonVersionInfo(bin_path="cp38-cp38"),
"3.9": PythonVersionInfo(bin_path="cp39-cp39"),
"3.10": PythonVersionInfo(bin_path="cp310-cp310"),
"3.11": PythonVersionInfo(bin_path="cp311-cp311"),
}
DEFAULT_PYTHON_VERSION = "3.8"
DEFAULT_BUILD_TYPE = "optimized"
Expand All @@ -38,7 +37,6 @@ def __init__(self, python_version: str, build_type: str, architecture: str) -> N
assert build_type in BUILD_TYPES, f"build_type must be one of {BUILD_TYPES}"
self.build_type = build_type
self.bin_path = python_version_info["bin_path"]
self.numpy_version = python_version_info["numpy_version"]

def run(self) -> None:
# chown is required to allow forge to upload the wheel
Expand All @@ -53,7 +51,7 @@ def run(self) -> None:

cmds += [
"./ci/build/build-manylinux-ray.sh",
f"./ci/build/build-manylinux-wheel.sh {self.bin_path} {self.numpy_version}",
f"./ci/build/build-manylinux-wheel.sh {self.bin_path}",
"chown -R 2000:100 /artifact-mount",
]
self.run_script(cmds)
4 changes: 2 additions & 2 deletions ci/ray_ci/test_builder_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _mock_run_script(input: List[str]) -> None:
BuilderContainer("3.10", "optimized", "x86_64").run()
assert cmds[-1] == [
"./ci/build/build-manylinux-ray.sh",
"./ci/build/build-manylinux-wheel.sh cp310-cp310 1.22.0",
"./ci/build/build-manylinux-wheel.sh cp310-cp310",
"chown -R 2000:100 /artifact-mount",
]

Expand All @@ -36,7 +36,7 @@ def _mock_run_script(input: List[str]) -> None:
assert cmds[-1] == [
"export RAY_DEBUG_BUILD=debug",
"./ci/build/build-manylinux-ray.sh",
"./ci/build/build-manylinux-wheel.sh cp39-cp39 1.19.3",
"./ci/build/build-manylinux-wheel.sh cp39-cp39",
"chown -R 2000:100 /artifact-mount",
]

Expand Down
23 changes: 11 additions & 12 deletions python/build-wheel-manylinux2014.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ set -exuo pipefail

export RAY_INSTALL_JAVA="${RAY_INSTALL_JAVA:-0}"

# Python version key, interpreter version code, numpy tuples.
PYTHON_NUMPYS=(
"py38 cp38-cp38 1.14.5"
"py39 cp39-cp39 1.19.3"
"py310 cp310-cp310 1.22.0"
"py311 cp311-cp311 1.22.0"
# Python version key, interpreter version code
PYTHON_VERSIONS=(
"py38 cp38-cp38"
"py39 cp39-cp39"
"py310 cp310-cp310"
"py311 cp311-cp311"
)

# Add the repo folder to the safe.dictory global variable to avoid the failure
Expand All @@ -25,16 +25,15 @@ source "$HOME"/.nvm/nvm.sh
./ci/build/build-manylinux-ray.sh

# Build ray wheel
for PYTHON_NUMPY in "${PYTHON_NUMPYS[@]}" ; do
PYTHON_VERSION_KEY="$(echo "${PYTHON_NUMPY}" | cut -d' ' -f1)"
for PYTHON_VERSIONS in "${PYTHON_VERSIONS[@]}" ; do
PYTHON_VERSION_KEY="$(echo "${PYTHON_VERSIONS}" | cut -d' ' -f1)"
if [[ "${BUILD_ONE_PYTHON_ONLY:-}" != "" && "${PYTHON_VERSION_KEY}" != "${BUILD_ONE_PYTHON_ONLY}" ]]; then
continue
fi

PYTHON="$(echo "${PYTHON_NUMPY}" | cut -d' ' -f2)"
NUMPY_VERSION="$(echo "${PYTHON_NUMPY}" | cut -d' ' -f3)"
PYTHON="$(echo "${PYTHON_VERSIONS}" | cut -d' ' -f2)"

echo "--- Build wheel for ${PYTHON}, numpy=${NUMPY_VERSION}"
echo "--- Build wheel for ${PYTHON}"

# The -f flag is passed twice to also run git clean in the arrow subdirectory.
# The -d flag removes directories. The -x flag ignores the .gitignore file,
Expand All @@ -43,7 +42,7 @@ for PYTHON_NUMPY in "${PYTHON_NUMPYS[@]}" ; do
# dependency constraints.
git clean -f -f -x -d -e .whl -e python/ray/dashboard/client -e dashboard/client -e python/ray/jars -e python/requirements_compiled.txt

./ci/build/build-manylinux-wheel.sh "${PYTHON}" "${NUMPY_VERSION}"
./ci/build/build-manylinux-wheel.sh "${PYTHON}"
done

# Clean the build output so later operations is on a clean directory.
Expand Down

0 comments on commit 9cddc36

Please sign in to comment.