Ray with Apple M1

Has anybody tried running Ray with Apple M1 processor? Either through Rosetta or Natively ?

I don’t think anyone on Ray team has a machine with M1 unfortunately. So let’s see if anyone in the community does.

But @Praseeth_Prabhakaran what’s your specific question about it? Did you try and run into issues? Thanks

No. I just ordered an MBA with M1. I will update here once it comes and I test a simple code using ray. I just wanted to know if anyone tried it already

I have tried it already with Rosetta. It seems like ray works. However, you have to run python with sudo.

Unfortunately rllib doesn’t work at all. It crashes with an illegal hardware instruction.

1 Like

cc @sven1977 we should potentially start taking a look at this

1 Like

Any updates on this? I’m getting a new M1 Mac, would be nice if Ray worked.

I tune+rllib working with arm64 linux, see ARM64 Support/CI integration

I have been meaning to try it on my M1(arm64) MacBook, but other things have come up. Seeing as it works for both Darwin x86 and Linux arm64, it should not be too difficult to build for Darwin arm64.

Update: I actually did compile it a while back on my M1 MacBook for arm (not x86). You need to install bazel and various other deps. I suggest using miniforge various deps for an arm64 target.

However, running ray does not yet work

>>> import ray
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/smorad/code/from_src/ray/python/ray/__init__.py", line 68, in <module>
    _configure_system()
  File "/Users/smorad/code/from_src/ray/python/ray/__init__.py", line 65, in _configure_system
    CDLL(so_path, ctypes.RTLD_GLOBAL)
  File "/Users/smorad/miniforge3/envs/rl/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/smorad/code/from_src/ray/python/ray/_raylet.so, 10): no suitable image found.  Did find:
	/Users/smorad/code/from_src/ray/python/ray/_raylet.so: mach-o, but wrong architecture
	/Users/smorad/code/from_src/ray/python/ray/_raylet.so: mach-o, but wrong architecture

Build completes, but I get error messages:

INFO: From Linking python/ray/_raylet.so:
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::~__assoc_state() from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::~__assoc_state() from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::__on_zero_shared() from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol void std::__1::__assoc_state<ray::Status>::set_value<ray::Status const&>(ray::Status const&) from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::move() from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol typeinfo name for std::__1::__assoc_state<ray::Status> from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol vtable for std::__1::__assoc_state<ray::Status> from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol typeinfo for std::__1::__assoc_state<ray::Status> from bazel-out/darwin-opt/bin/libcore_worker_lib.a(core_worker.pic_7b78aca6b2fd2113215b5d3a7c64d4f7.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::~__assoc_state() from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::~__assoc_state() from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::__on_zero_shared() from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol void std::__1::__assoc_state<ray::Status>::set_value<ray::Status const&>(ray::Status const&) from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol std::__1::__assoc_state<ray::Status>::move() from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol vtable for std::__1::__assoc_state<ray::Status> from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol typeinfo for std::__1::__assoc_state<ray::Status> from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)
ld: warning: cannot export hidden symbol typeinfo name for std::__1::__assoc_state<ray::Status> from bazel-out/darwin-opt/bin/libgcs.a(accessor.pic_46f629cf7de15f7d7489bb74c90a7279.o)

I suspect once raylet is fixed, this will work on the M1 chip.

As of this morning, on my new mac book pro 13 m1, I could:

  • pip install ‘ray[default]’
  • build xgboost on my machine for the arm arch from my clone of xgboost
  • pip install xgboost from the clone
  • pip install xgboost-ray

And run my Feast workshop module 3 with Ray on single host, single core, and single host, multiple cores.

1 Like

I’m trying to install ray on my Mac book pro 13 m1 but getting the following error:

pip install ray
ERROR: Could not find a version that satisfies the requirement ray (from versions: none)
ERROR: No matching distribution found for ray

The python version is 3.9, also tried with 3.8.

Have you encountered anything similar?

Make sure your pip is the latest version and python is 3.9.5
pip --version
pip 21.2.4 from /opt/miniconda3/lib/python3.9/site-packages/pip (python 3.9)

python --version
Python 3.9.5

pip install "ray[default]"

Thanks for replying @dmatrixjsd. I have the same versions of both pip and python and I managed to install ray via anaconda’s 3.8 python. Installing from a virtual environment with python 3.9 or miniconda64 still throws the errors. Weird stuff.

cc @Alex I thought we were in the process of ARM support. Is that still in progress?