Skip to content

Instantly share code, notes, and snippets.

@abishekmuthian
Last active July 12, 2023 07:24
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save abishekmuthian/aa0bf2feb02aedb3b38eef203b4b8cc4 to your computer and use it in GitHub Desktop.
Save abishekmuthian/aa0bf2feb02aedb3b38eef203b4b8cc4 to your computer and use it in GitHub Desktop.
Build and Install Ray on ARM (aarch64)

Dependencies

Only dependencies which aren't highly likely to be featured in a ARM development environment are featured here, Obvious dependencies such as Python3, Python2, pip, wheel, GCC etc. aren't covered here.

Bazel

Note : Use bazel 1.x.x for Ray as 2.x.x is not supported.

sudo apt-get install build-essential openjdk-8-jdk unzip
export JAVA_HOME="/usr/bin/java"
wget https://github.com/bazelbuild/bazel/releases/download/1.0.0/bazel-1.0.0-dist.zip
unzip bazel-1.0.0-dist.zip
cd bazel-1.0.0
./compile.sh

py-spy

py-spy is a python profiling library written in rust. It's easier to install it via rust's package manager on ARM.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install py-spy

Download Ray from git

Download ray from git and checkout the commit without PyArrow dependency.

git clone https://github.com/ray-project/ray.git
git checkout fae99ecb8e8d750bddcb3674f720f068541dc15d

Patching BUILD.boost

Update: This patch has been added to the upstream - nelhage/rules_boost#168. So, one could skip this step. If you face the errors discussed in this issue - ray-project/ray#7184, then follow the patching process mentioned below.

The bazel build rules for installing boost library has assembly files which doesn't compile on ARM64 and missing some default conditions. I have prepared a patch to address it - https://gist.github.com/heavyinfo/25cf56fe0b5f8509dd0120257d008d3f

Download the patch and place it in ray/thirdparty/patches.

Add path to the patch here https://github.com/ray-project/ray/blob/fae99ecb8e8d750bddcb3674f720f068541dc15d/bazel/ray_deps_setup.bzl#L138.

Building ray

cd ray/python
python3 setup.py bdist_wheel

Installing ray

cd ray/python/dist
pip install ray-0.9.0.dev0-cp36-cp36m-linux_aarch64.whl

Troubleshooting

Permission errors

If there are any permission related errors, run the above commands with sudo after understanding the risks of doing so and that every installation command after that may require sudo.

@wellsoliver
Copy link

For the bazel build, I had to set JAVA_HOME to /usr/lib/jvm/java-8-openjdk-arm64 -- using the /usr/bin/java complains ERROR: JAVA_HOME (/usr/bin/java) is not a path to a working JDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment