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.
cc @sven1977 we should potentially start taking a look at this
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.
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?
In my case I could not install ray[tune] in an arm/noarch conda env.
BUT starting a terminal with rosetta and create conda env like this:
CONDA_SUBDIR=osx-64 conda create -n rosetta python=3.9 # create a new environment called rosetta with intel packages.
conda activate rosetta
python -c "import platform;print(platform.machine())"
conda env config vars set CONDA_SUBDIR=osx-64 # make sure that conda commands in this environment use intel packages
conda deactivate
conda activate rosetta
echo "CONDA_SUBDIR: $CONDA_SUBDIR"
pip install ray[tune]
Then it worked! Of course, this means it all runs with Rosetta.
What does it like to run RL/DL algorithm via Ray on an M1 MacBook? Is it significantly faster than other X86 computers? Just curious.
Just to follow up, there are now official wheels for M1 starting with Ray 1.8!
https://docs.ray.io/en/master/installation.html#apple-silicon-support
Hello there, I following the official site and install ray on Apple M1.
Couple of things I notice.
- To test in the installation, we need to do this: python -m pytest -v python/ray/tests/test_mini.py. But, the installation doesn’t include test_mini.py. As such, you need to pull in from github repo. After that, you can run the installation test. And, there is a new error surface as below:
ImportError while loading conftest ‘/Users/“path to test_mini.py”/confttest.py’ .
python/ray/tests/conftest.py:27: in
from ray.provate.test.utils import (
ImportError: cannot import name “RayletKiller” from 'ray.private.test_utils…
Can anyone share some insights on what this error is? Is the installation correct?
Can you share how exactly you installed Ray? Did you go through pypi or are you trying to compile from source?
Hello Sam,
I just follow the steps as outlined: Installing Ray — Ray 2.23.0. Since it is apple M, I gollow the get the miniforge steps and then install via pip.
Then, I want to test the installation. That’s where I start to hit the above error.
Hmm…that is weird. To unblock can you ignore the miniforge conda setup and just pip install ray?
If that works and unblocks please proceed and if you could cut a Github ticket for the missing miniforge setup we will follow up.