[Misc] Make compile_llm_requirements.sh runnable on macos#55664
[Misc] Make compile_llm_requirements.sh runnable on macos#55664aslonnie merged 7 commits intoray-project:masterfrom
compile_llm_requirements.sh runnable on macos#55664Conversation
There was a problem hiding this comment.
Code Review
This pull request makes the compile_llm_requirements.sh script runnable on macOS by handling differences in the sed command and ensuring a consistent Python platform for dependency compilation. The changes are logical and achieve the goal. I've provided a suggestion to further improve the script's portability by using a sed pattern that avoids introducing a new dependency (gsed) for macOS users, which should enhance the developer experience.
ci/compile_llm_requirements.sh
Outdated
| SED_CMD=sed | ||
| # On macos, use gnu-sed because 'sed -i' may not be used with stdin | ||
| if [[ "$(uname)" == "Darwin" ]]; then | ||
| # check if gsed is available | ||
| if ! command -v gsed &> /dev/null; then | ||
| echo "--- gsed is not installed. Install via `brew install gnu-sed`" | ||
| exit 1 | ||
| fi | ||
| SED_CMD=gsed | ||
| fi |
There was a problem hiding this comment.
While using gsed on macOS is a common workaround, it introduces a new dependency for developers. A more portable approach that works with both BSD sed (on macOS) and GNU sed (on Linux) without any extra dependencies is to use a temporary file for in-place editing. This would improve the developer experience by not requiring them to install gnu-sed.
With the alternative I'm suggesting for the sed commands, this entire block for SED_CMD logic can be removed.
Also, the comment on line 6 is slightly inaccurate. The issue with sed -i on macOS isn't about stdin, but that it requires an argument for the backup file extension, unlike GNU sed.
There was a problem hiding this comment.
Pending other reviewers' opinion
There was a problem hiding this comment.
Mmmm while I don't think it's a huge ask to have folks gnu-sed there might be some additional overhead we'd take in making sure CI machines had it.... Which also isn't huge, but it's noise. I think I'm content to listen to the robot on this one (provided it works)
There was a problem hiding this comment.
Got it, I've updated according to Gemini suggestion
ci/compile_llm_requirements.sh
Outdated
| ${SED_CMD} -i '/^--extra-index-url /d' /tmp/ray-deps/requirements_compiled.txt | ||
| ${SED_CMD} -i '/^--find-links /d' /tmp/ray-deps/requirements_compiled.txt |
There was a problem hiding this comment.
To avoid the portability issues with sed -i and remove the need for gsed on macOS, you can use a temporary file. This approach is portable across different sed versions. It also allows combining both sed operations into a single command, which is slightly more efficient.
This change should be coupled with the removal of the SED_CMD logic at the beginning of the script.
| ${SED_CMD} -i '/^--extra-index-url /d' /tmp/ray-deps/requirements_compiled.txt | |
| ${SED_CMD} -i '/^--find-links /d' /tmp/ray-deps/requirements_compiled.txt | |
| sed -e '/^--extra-index-url /d' -e '/^--find-links /d' /tmp/ray-deps/requirements_compiled.txt > /tmp/ray-deps/requirements_compiled.txt.tmp | |
| mv /tmp/ray-deps/requirements_compiled.txt.tmp /tmp/ray-deps/requirements_compiled.txt |
Signed-off-by: Linkun <github@lkchen.net>
Signed-off-by: Linkun <github@lkchen.net>
3683856 to
b2a3165
Compare
ci/raydepsets/rayllm.depsets.yaml
Outdated
| - --extra-index-url https://download.pytorch.org/whl/${CUDA_CODE} | ||
| append_flags: | ||
| - --python-version=3.11 | ||
| - --python-platform=x86_64-manylinux_2_28 |
There was a problem hiding this comment.
this should be manylinux2014 rather than 2_28?
or does generic linux work? which is the default target when running on linux?
the manylinux variation should not really matter here if we are not compiling any (non-python, binary) things from source.
There was a problem hiding this comment.
I did hit error
╰─▶ Because nixl==0.3.1 has no wheels with a matching platform tag (e.g.,
`manylinux_2_17_x86_64`) and you require nixl==0.3.1, we can conclude that
your requirements are unsatisfiable.
hint: Wheels are available for `nixl` (v0.3.1) on the following platform:
`manylinux_2_28_x86_64````
There was a problem hiding this comment.
have you tried "linux"? not sure if we want to pin to a specific manylinux or architecture right now yet.
There was a problem hiding this comment.
linux works, updated
and for my own reference astral-sh/uv#14300 uv is aliasing linux to 2_28
| sed -e '/^--extra-index-url /d' -e '/^--find-links /d' /tmp/ray-deps/requirements_compiled.txt > /tmp/ray-deps/requirements_compiled.txt.tmp | ||
| mv /tmp/ray-deps/requirements_compiled.txt.tmp /tmp/ray-deps/requirements_compiled.txt |
There was a problem hiding this comment.
this is just because mac's sed does not have a -i?
maybe convert this into a python script (or py_binary) instead?
There was a problem hiding this comment.
TBH python is less readable than sed, I used temporary file due to #55664 (comment)
Signed-off-by: Linkun <github@lkchen.net>
|
Shall we merge or enable auto-merge? |
…oject#55664) apple silicon macbooks only though. --------- Signed-off-by: Linkun <github@lkchen.net> Signed-off-by: Andrew Grosser <dioptre@gmail.com>
…oject#55664) apple silicon macbooks only though. --------- Signed-off-by: Linkun <github@lkchen.net>
…oject#55664) apple silicon macbooks only though. --------- Signed-off-by: Linkun <github@lkchen.net> Signed-off-by: jugalshah291 <shah.jugal291@gmail.com>
apple silicon macbooks only though. --------- Signed-off-by: Linkun <github@lkchen.net> Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
…oject#55664) apple silicon macbooks only though. --------- Signed-off-by: Linkun <github@lkchen.net>
Why are these changes needed?
Improve dev experience, for trivial changes I don't need to ssh to linux machine.
Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.ci/compile_llm_requirements.shon macos