Skip to content

[Misc] Make compile_llm_requirements.sh runnable on macos#55664

Merged
aslonnie merged 7 commits intoray-project:masterfrom
lk-chen:ci_compile_x_platform
Aug 20, 2025
Merged

[Misc] Make compile_llm_requirements.sh runnable on macos#55664
aslonnie merged 7 commits intoray-project:masterfrom
lk-chen:ci_compile_x_platform

Conversation

@lk-chen
Copy link
Contributor

@lk-chen lk-chen commented Aug 15, 2025

Why are these changes needed?

Improve dev experience, for trivial changes I don't need to ssh to linux machine.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(
    • Run ci/compile_llm_requirements.sh on macos

Signed-off-by: Linkun <github@lkchen.net>
@lk-chen lk-chen requested a review from aslonnie August 15, 2025 19:54
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +5 to +14
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending other reviewers' opinion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I've updated according to Gemini suggestion

Comment on lines +46 to +47
${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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
${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

@lk-chen lk-chen requested review from elliot-barn and khluu August 15, 2025 19:59
@lk-chen lk-chen mentioned this pull request Aug 15, 2025
8 tasks
Signed-off-by: Linkun <github@lkchen.net>
@lk-chen lk-chen force-pushed the ci_compile_x_platform branch from 3683856 to b2a3165 Compare August 15, 2025 22:17
@lk-chen lk-chen requested a review from ZacAttack August 15, 2025 23:16
@ray-gardener ray-gardener bot added the devprod label Aug 16, 2025
- --extra-index-url https://download.pytorch.org/whl/${CUDA_CODE}
append_flags:
- --python-version=3.11
- --python-platform=x86_64-manylinux_2_28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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````

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried "linux"? not sure if we want to pin to a specific manylinux or architecture right now yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linux works, updated

and for my own reference astral-sh/uv#14300 uv is aliasing linux to 2_28

Comment on lines +16 to +17
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just because mac's sed does not have a -i?

maybe convert this into a python script (or py_binary) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH python is less readable than sed, I used temporary file due to #55664 (comment)

@lk-chen lk-chen requested a review from aslonnie August 18, 2025 18:38
@lk-chen lk-chen added the go add ONLY when ready to merge, run all tests label Aug 19, 2025
@lk-chen
Copy link
Contributor Author

lk-chen commented Aug 19, 2025

Shall we merge or enable auto-merge?

@lk-chen lk-chen mentioned this pull request Aug 20, 2025
8 tasks
@aslonnie aslonnie merged commit 5c31311 into ray-project:master Aug 20, 2025
5 checks passed
@lk-chen lk-chen deleted the ci_compile_x_platform branch August 20, 2025 07:10
dioptre pushed a commit to sourcetable/ray that referenced this pull request Aug 20, 2025
…oject#55664)

apple silicon macbooks only though.

---------

Signed-off-by: Linkun <github@lkchen.net>
Signed-off-by: Andrew Grosser <dioptre@gmail.com>
alimaazamat pushed a commit to alimaazamat/ray that referenced this pull request Aug 21, 2025
…oject#55664)

apple silicon macbooks only though.

---------

Signed-off-by: Linkun <github@lkchen.net>
jugalshah291 pushed a commit to jugalshah291/ray_fork that referenced this pull request Sep 11, 2025
…oject#55664)

apple silicon macbooks only though.

---------

Signed-off-by: Linkun <github@lkchen.net>
Signed-off-by: jugalshah291 <shah.jugal291@gmail.com>
dstrodtman pushed a commit that referenced this pull request Oct 6, 2025
apple silicon macbooks only though.

---------

Signed-off-by: Linkun <github@lkchen.net>
Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
…oject#55664)

apple silicon macbooks only though.

---------

Signed-off-by: Linkun <github@lkchen.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants