Ray for Rapberry Pi, is possible?

I would like to create regulator for measurement system based on Raspberry Pi controllers. I wonder if is possible to use Ubuntu PC as trainer and raspberry Pi 3 or 4 as workers.
I tested that its possible to install tensorflow 2 in raspberry Pi but is possible to install rllib (or some siplified version with workers only - no redis, no GPU for training) in raspberry arm systems?

My idea:

1 Like

cc @Alex Can you answer the question for him?

Hey, we don’t have official ARM wheels, but many users have reported being able to successfully build Ray from source on Raspberry Pi and other ARM devices. There are a few dependencies that don’t have official ARM builds, but those can also be built from source (you can just pip install directly from their github pages).

Let us know if you have any trouble!

1 Like

Thank You for the answer. I will try to find theese unofficial builds.

I found liks with raspberry ray images:
https://github.com/ray-project/ray/issues/12128

but I try to find some tutorial how to make ray package for raspberry pi 4.

I look for wheel package ray-2.0.0.dev0 for raspberry pi 4 armv7l python 3.8.
Maybe there is some tutorial how to build ray from source for raspberry because I don’t know how to change code from: https://docs.ray.io/en/master/development.html#building-ray-full to raspberry pi.
It’s not important for me if compilation is in raspberry or cross-compilation because waiting isn’t a problem.
I will be grateful for any suggestions.

Hey can you try to follow the regular build instructions, just on your raspberry pi, then post any errors you get?

@Alex I use instructions from page:
https://docs.ray.io/en/master/development.html

bazel build -c fastbuild //:ray_pkg

I installed bazel, npm, py-spy, rust, cargo becouse some errors were connected with its.
Errors now:

Huh, that’s strange. Can you run bazel build ray_pkg directly from the root of the ray project and post the output?

@Alex Yes, I use command directly from ray directory.

bazel build -c fastbuild //:ray_pkg
When I use bazel-3.2.0:

sudo /usr/local/bin/bazel-3.2.0 build -c fastbuild //:ray_pkg
the result is:

Hmm @barakmich this looks like related to the push manager? Looks like we should probably either cast to something platform independent or use unsigned long long?

Now I tried simple command:

python3 setup.py install

and again the same error:

Hmm I don’t have easy access to a Raspberry Pi (Lost mine :stuck_out_tongue: ), but can you try this branch? GitHub - wuisawesome/ray at fix_arm

@Alex Thank You, I will try it .

@Alex I tested this code by commands with Rapberry pi 4:

git clone --branch fix_arm --recurse-submodules GitHub - wuisawesome/ray: A fast and simple framework for building and running distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library.
sudo chmod -R 777 ./ray
cd ./ray/python/
python3 setup.py install

The result is:

@Alex I used branch https://github.com/wuisawesome/ray/tree/fix_arm

I installed libatomic library and used command with option:

bazel build --copt=“-latomic” -c opt //:ray_pkg

Now here is the error:

FAILED: Build did NOT complete successfully
pi@raspberrypi:/tmp/ray $ bazel build --copt=“-latomic” -c opt //:ray
INFO: Writing tracer profile to ‘/home/pi/.cache/bazel/_bazel_pi/c81ef09a5cf12e451dde4b8cf7740758/command.profile.gz’
DEBUG: /tmp/ray/bazel/ray_deps_setup.bzl:63:9: No implicit mirrors used because urls were explicitly provided
ERROR: Skipping ‘//:ray’: no such target ‘//:ray’: target ‘ray’ not declared in package ‘’ defined by /tmp/ray/BUILD.bazel
WARNING: Target pattern parsing failed.
ERROR: no such target ‘//:ray’: target ‘ray’ not declared in package ‘’ defined by /tmp/ray/BUILD.bazel

I will be grateful for any suggestions?

what’s the -c opt for here?

@Alex There is no special reason for that, I tested many combinations of options from https://docs.ray.io/en/master/development.html to check if some of its will finish without error.
The option fastbuild:

bazel build --copt=“-latomic” -c fastbuild //:ray_pkg

gives error:

unfortunatelly I dont’know how to fix error:

error: undefined reference to ‘__atomic_load_8’

Thank You for the activity in this topic :grinning:

hmmm i wonder if this is still related to this libatomic stuff. Can you try the ld preload suggestion from here? Undefined reference to __atomic_xxx · Issue #15278 · opencv/opencv · GitHub

@Alex for few days I have built packges in ray requirements files:
https://github.com/PeterPirog/Raspberry_armv7_builds
but now I’m confused which aproach is correct:

  1. try use “python3 setup.py bdist_wheel” command in /ray/python directory
  2. try tu use npn according to Building Ray from Source — Ray 3.0.0.dev0
  3. try tu use Building Ray (Python Only)
  4. try tu use script build.sh from /ray/build.sh
  5. try tu use “bazel build -c fastbuild //:ray_pkg”
  6. try somehow ./configure and make

The goal is still the same build wheel ray file for python 3.8 armv7
when I try option1 “python3 setup.py bdist_wheel” the problem is:

bazel-out/arm-opt/bin/_virtual_includes/ray_common/ray/common/ray_config_def.h:200:75: error: integer overflow in expression of type ‘long int’ results in ‘-2147483648’ [-Werror=overflow]
RAY_CONFIG(uint64_t, object_manager_max_bytes_in_flight, 2L * 1024 * 1024 * 1024)
~~~~~~~~~~~~~^~
bazel-out/arm-opt/bin/virtual_includes/ray_common/ray/common/ray_config.h:35:18: note: in definition of macro ‘RAY_CONFIG’
type name##
= default_value;

As I understand it means that long int type is too smal for the variable but how to solve overflow error?