ray icon indicating copy to clipboard operation
ray copied to clipboard

Wheel for Raspberry PI (ARM processor)

Open FormerLurker opened this issue 4 years ago • 59 comments

Describe your feature request

Could a wheel be created for installing via pip on a raspberry pi? I tested ray on windows, and it worked amazingly well, and would LOVE to get it working on a raspberry pi too. This would make it much easier to distribute my cross platform open-source application for raspberry pi users.

Thank you for your amazing work!

FormerLurker avatar Nov 18 '20 20:11 FormerLurker

I am surprised this has not come up earlier. How can we install on raspberry? pip seems to be not an option ... or am I missing some tricks of pip for these cases?

foice avatar Nov 29 '20 12:11 foice

It will need to be manually compiled for now. I'm sure it's come up before, but it takes time and effort to build a new wheel, so it's a question of demand I think.

I haven't had the time to manually build this and compile instructions yet, but I plan to. I got slammed with issues (holiday weekends are always like this) and have been stuck on those. I will update this issue with instructions ASAP.

FormerLurker avatar Nov 29 '20 15:11 FormerLurker

Thanks for the effort!

On Sun, Nov 29, 2020 at 4:03 PM FormerLurker [email protected] wrote:

It will need to be manually compiled for now. I'm sure it's come up before, but it takes time and effort to build a new wheel, so it's a question of demand I think.

I haven't had the time to manually build this and compile instructions yet, but I plan to. I got slammed with issues (holiday weekends are always like this) and have been stuck on those. I will update this issue with instructions ASAP.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ray-project/ray/issues/12128#issuecomment-735408059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHRUNONPTVMB6KFFIA4OY3SSJPFTANCNFSM4T2OBIBQ .

foice avatar Nov 29 '20 19:11 foice

Hey I've made a few builds last week (see https://github.com/ray-project/ray/issues/12835) for ray 1.0.1: All python3.6:

  • aarch64: https://github.com/ray-project/ray/files/5729517/ray-1.0.1-aarch64.zip
  • arm7: https://github.com/ray-project/ray/files/5703429/ray_armv7l_32bit.zip

PidgeyBE avatar Dec 24 '20 16:12 PidgeyBE

PidgeyBE avatar Dec 24 '20 17:12 PidgeyBE

Thnaks! Does it mean it is on pip, or we are supposed to test it? In the latter case how to install it on my python setup?

On Dec 24, 2020, at 17:39, PidgeyBE [email protected] wrote:

Hey I've made a few builds last week (see #12835) for ray 1.0.1:

aarch64: https://github.com/ray-project/ray/files/5729517/ray-1.0.1-aarch64.zip arm7: https://github.com/ray-project/ray/files/5703429/ray_armv7l_32bit.zip — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

foice avatar Dec 24 '20 20:12 foice

@foice It is not published in the Pypi repository, I don't have access to that, I've just built the wheels myself. So you should download the zip, unzip it, and install the wheels via

pip install py_spy_xxxxxxxxx.whl
pip install ray-xxxxxxxx.whl

PidgeyBE avatar Dec 24 '20 22:12 PidgeyBE

@PidgeyBE Would you happen to have a wheel for aarch64 + Python 3.8? I'm trying to make this work natively on a mac M1 but I haven't been able to build ray correctly.

deetungsten avatar Dec 25 '20 03:12 deetungsten

@deetungsten I've just compiled them for you, Merry Christmas! ray-1.1.0-cp38-aarch64.zip Let me know if it works! I've tested it locally in an emulator and it works...

PidgeyBE avatar Dec 25 '20 09:12 PidgeyBE

Hey, thank you @PidgeyBE!!! I have been buried under a mountain of end of the year work. Today's the earliest I had a chance to look at this, so THANK YOU for saving me time and effort :)

FormerLurker avatar Dec 25 '20 20:12 FormerLurker

@PidgeyBE WOW thank you so much! Ahah best Christmas gift ever! I will test it later tonight after all the Christmas activities. Merry Christmas!

deetungsten avatar Dec 25 '20 22:12 deetungsten

Is it somehow possible to compile ray for arch64 + Python 3.9 for a M1 Mac? I have to decide if I go for Python 3.8 or 3.9, ray is the only missing piece for 3.9.

Johannes-Lange avatar Dec 26 '20 16:12 Johannes-Lange

@Johannes-Lange I feel your pain. I spent most of last night trying to compile Pytorch for 3.8 (there's only a 3.9 beta wheel) and I couldn't get it to work because of clang issues. I thought about using tensorflow backend instead but it wouldn't work for some reason. The Apple Tensorflow version with the M1 GPU acceleration is 3.8 only. The M1 have been a viscous cycle of trying to make everything work together with the right Python version.

deetungsten avatar Dec 27 '20 00:12 deetungsten

@deetungsten pytorch runs quite nicely in my 3.9 environment, using the crosscompiled numpy from conda-forge. So I don’t want to change that... The problem I am facing with ray is bazel for the building, all other dependencies do work.

Johannes-Lange avatar Dec 27 '20 10:12 Johannes-Lange

@Johannes-Lange I'll try to build ray for python 3.9 and aarch64. I can't give any guarantees though, because ray doesn't even have Python 3.9 support... Anyhow, I'll run our build scripts on this branch https://github.com/ray-project/ray/pull/12613 and see what comes out...

PidgeyBE avatar Dec 27 '20 11:12 PidgeyBE

@Johannes-Lange This version (ray 1.2.0dev0!) seems to work in my qemu/docker emulation env for aarch64/python3.9: ray-1.2.0.dev0-aarch64-cp39.zip (the zip contains a py_spy wheel as well)

PidgeyBE avatar Dec 27 '20 14:12 PidgeyBE

Both 3.8 and 3.9 wheels gets this issue ERROR: py_spy-0.3.3-cp38-cp38-linux_aarch64.whl is not a supported wheel on this platform. :(

deetungsten avatar Dec 27 '20 17:12 deetungsten

@deetungsten you have to change the name to "ray-1.2.0.dev0-cp39-cp39-macosx_11_0_arm64.whl" (maybe 11_1, has to be your os version), same for py-spy.

Johannes-Lange avatar Dec 27 '20 17:12 Johannes-Lange

Edit: Works now! I had to run pip3 install --no-dependencies --force ray-1.2.0.dev0-cp39-cp39-macosx_11_0_arm64.whl for 3.9 but decided to use the 3.8 for tensorflow reasons (I used the same renaming trick). I think tensorflow + Apple/CoreML acceleration works with this but will need to try a couple tests to know for sure.

@Johannes-Lange @PidgeyBE IT WORKS!!! Thank you both so much! Interestingly, I never knew wheel names mattered. Is this only special to mac or is this the same for Linux too? Also, even though I have 11.1 as my OS version, 11_0 is what worked.

deetungsten avatar Dec 27 '20 18:12 deetungsten

@deetungsten afaik the name matters always. The installation worked, but I get an error when calling ray.init() because some files are an unknown format. Does it work for you? If yes, what is your configuration?

Johannes-Lange avatar Dec 27 '20 18:12 Johannes-Lange

@Johannes-Lange I have issues too loading ray but with a different issue OSError: dlopen(/Users/USERNNAME/miniforge3/envs/ENVNNAME/lib/python3.8/site-packages/ray/_raylet.so, 10): no suitable image found. I'm running python 3.8 with conda, tensorflow + pytorch (nightly build).

deetungsten avatar Dec 27 '20 18:12 deetungsten

@deetungsten ok, I got the same error + some unknown file format stuff. So far it looks like a common mac error, maybe caused because the wheel is built for Linux. I will keep trying to build bazel for arm mac, then I could also build the ray wheel. If that works I’ll let you know, but I can’t promise anything.

Johannes-Lange avatar Dec 27 '20 19:12 Johannes-Lange

Thanks @PidgeyBE for providing these wheels! I'm currently working on using cluster config, but I'm having issues because the docker images ray up relies on are all x86_64. Has anyone managed to munge the dockerfiles to work with aarch64 yet?

umbernhard avatar Jan 11 '21 17:01 umbernhard

Actually, I just built my own. I couldn't quite get the ray-ml equivalent to build, but for a RPi cluster I'm not sure that all of it is needed. I also ported from Conda to Pip where possible, which required some minor versioning fixes but nothing too serious.

aarch64 compatible docker images:

Github repo with dockerfiles: https://github.com/umbernhard/ray-docker-arm

umbernhard avatar Jan 12 '21 16:01 umbernhard

@PidgeyBE Thank you for arm7 repo: https://github.com/ray-project/ray/files/5703429/ray_armv7l_32bit.zip

I would like to ask where can I find tutorial how to build whl files for raspberry. I'm beginner in this topic and I would like learn it from basics. If some one can recommand soe tutorial or book I will be gratefull.

PeterPirog avatar Jan 22 '21 13:01 PeterPirog

@PeterPirog The docs to build ray wheels are here: https://docs.ray.io/en/master/development.html#building-ray-full The complexity to build for ARM is that you first have to compile bazel for ARM. But in the version currently used by ray there are less complexities than before (there is no patching of Bazel needed anymore afaik). Additionally, building and compiling is pretty resource intensive, so instead of building it on a raspberry pi, you could always look into cross compilation. We are using docker & qemu for that. So we can build ARM wheels on regular hardware...

PidgeyBE avatar Jan 22 '21 19:01 PidgeyBE

@PidgeyBE Thank You for the answer and link. I can build bazel with proper version thanks to this repo: https://github.com/koenvervloesem/bazel-on-arm I noticed that compiling is resource expensive ( now I try compile tensorflow, it last over 2 hours with 100 % CPU Usage, Raspberry 4 with 8GB RAM). Unfortunatelly I dont't understand some dpendencies in building proces so my work is simillar to pushing colur buttons by monkey :) I copy some parts of codes from many tutorials and try to use and understand its.

PeterPirog avatar Jan 22 '21 20:01 PeterPirog

@PidgeyBE @umbernhard Does someone have ray-2.0.0.dev whl file for python 3.7 or other version for python 3.7?

I try to build something myself but when I use tutorial https://docs.ray.io/en/master/development.html command "python python/ray/setup-dev.py" shows me that if I want to compile python 3.7 ray I need python 3.7 ray.

PeterPirog avatar Jan 24 '21 20:01 PeterPirog

@PidgeyBE is it possible to provide me a ray-2.0.0.whl for jeston nano and python 3.8. Thank you in advance. I am not able to build it myself.

arunbv123 avatar Feb 06 '21 04:02 arunbv123

@PeterPirog master/ray-2.0.0.dev builds fail on armv7 at our side.. @arunbv123 I've made a python3.8 aarch64 build which should work on Nvidia Jetsons: ray-2.0.0.dev0-cp38-cp38-linux_aarch64.zip

PidgeyBE avatar Feb 08 '21 13:02 PidgeyBE