Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing Ray Core on Rasbperry Pi 4B #12835

Closed
rodorio opened this issue Dec 13, 2020 · 20 comments
Closed

Installing Ray Core on Rasbperry Pi 4B #12835

rodorio opened this issue Dec 13, 2020 · 20 comments

Comments

@rodorio
Copy link

rodorio commented Dec 13, 2020

Hello,

I dont know if this is the correct place to post this but I'm wanting to install Ray on my rasberry-pi but I keep getting the following message:

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

From what I understand this is due to the fact that Ray does not currently build a wheel for ARM.

I was wondering if someone had instructions on how to install it/build it for the pi. If it makes it easier I'm only looking to install the Ray core for now.

Thanks!

@PidgeyBE
Copy link
Contributor

We are working on ARM builds.
I should have a ray 0.8.5 somewhere if you'd like and I'm currently trying to build ray 1.0.1.

If Ray team could give us some pointers of where to put our code (using qemu/docker for emulation ARM environment) we could put it in the ray repository.

@PidgeyBE
Copy link
Contributor

@rodorio This zip should contain a wheel for ray 1.0.1 on ARM. Would you mind testing it?
ray-1.0.1-cp36-cp36m-linux_aarch64.zip

@rodorio
Copy link
Author

rodorio commented Dec 15, 2020

Thanks @PidgeyBE! I dont know if I did it right but I got this error:

$pip install /home/pi/Downloads/ray-1.0.1-cp36-cp36m-linux_aarch64.whl
ray-1.0.1-cp36-cp36m-linux_aarch64.whl is not a supported wheel on this platform.

@rodorio
Copy link
Author

rodorio commented Dec 15, 2020

Ok, I think I figured it out, my RPI has armv71 instead of aarch64.

@rodorio
Copy link
Author

rodorio commented Dec 15, 2020

Ok, apparently there is a 64 bit version of Raspbian thats in beta. I'm gonna try to update to it tomorrow.

@PidgeyBE
Copy link
Contributor

@rodorio Yes indeed there is. I'm also trying to build a release for ARMv7.
But it takes a long time :)

@PidgeyBE
Copy link
Contributor

@rodorio I've build ray and py-spy (ray dependency) for ARMv7l. Would be interesting if you could try it out!
ray-pyspy-armv7l.zip

@rodorio
Copy link
Author

rodorio commented Dec 16, 2020

Hm, looks like the same error. Any ideas?

$pip install /home/pi/Downloads/py_spy-0.3.3-cp36-cp36m-linux_armv7l.whl
py_spy-0.3.3-cp36-cp36m-linux_armv7l.whl is not a supported wheel on this platform.

@rodorio
Copy link
Author

rodorio commented Dec 16, 2020

Got a little further:

$python3.6 -m pip install py_spy-0.3.3-cp36-cp36m-linux_armv7l.whl
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
	"__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
	exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
	from pip._internal import main as _main  # isort:skip # noqa
  File "/usr/lib/python3/dist-packages/pip/_internal/__init__.py", line 40, in <module>
	from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
	from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
	from pip._internal.cli import cmdoptions
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module>
	from pip._internal.locations import USER_CACHE_DIR, src_prefix
  File "/usr/lib/python3/dist-packages/pip/_internal/locations.py", line 10, in <module>
	from distutils import sysconfig as distutils_sysconfig
ImportError: cannot import name 'sysconfig'

@rodorio
Copy link
Author

rodorio commented Dec 16, 2020

I think its because I have both python 3.6 and 3.7 installed but I cant seem to be able to fix it. I may try looking into virtual environments but I've never worked with them before.

@PidgeyBE
Copy link
Contributor

PidgeyBE commented Dec 16, 2020

I got myself a RasPi4 and the following worked for me, using conda environments:
(The benefit of conda over virtualenv will be that conda can download packages that are already compiled/built for ARM. Conda is also pretty well isolated from the system python installations)

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
sudo md5sum Miniconda3-latest-Linux-armv7l.sh # (optional) check md5
chmod +x Miniconda3-latest-Linux-armv7l.sh
./Miniconda3-latest-Linux-armv7l.sh # -> change default directory to /home/pi/miniconda3
bash
conda config --add channels rpi
conda create -n ray python=3.6
source activate ray
pip install py_spy-0.3.3-cp36-cp36m-linux_armv7l.whl
pip install ray-1.0.1-cp36-cp36m-linux_armv7l.whl

... this last step takes a while... will update when finished...

>>> import ray
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/miniconda3/envs/ray/lib/python3.6/site-packages/ray/__init__.py", line 61, in <module>
    CDLL(so_path, ctypes.RTLD_GLOBAL)
  File "/home/pi/miniconda3/envs/ray/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/pi/miniconda3/envs/ray/lib/python3.6/site-packages/ray/_raylet.so: wrong ELF class: ELFCLASS64

:(

@PidgeyBE
Copy link
Contributor

This version works for me on Raspberry Pi 4, 32bit OS: ray_armv7l_32bit.zip

@rodorio
Copy link
Author

rodorio commented Dec 17, 2020

Nice! I've been swamped today but I'll give it a try tomorrow. Was it still using the conda env?

@PidgeyBE
Copy link
Contributor

Yes, indeed! Instructions above, with conda, but with that last zip file!

@rodorio
Copy link
Author

rodorio commented Dec 18, 2020

Ah darn, I think I broke my bash installation messing around with pyenv a few days ago. Imma try to see if I can undo what I did:

bash: export: $': not a valid identifier bash: export: export PATH="/home/pi/.pyenv/shims:${PATH}"

@rodorio
Copy link
Author

rodorio commented Dec 22, 2020

Hm so I got it to install but it wont run:

`Traceback (most recent call last):
File "/home/pi/.pyenv/versions/3.6.12/bin/ray", line 5, in
from ray.scripts.scripts import main
File "/home/pi/.pyenv/versions/3.6.12/lib/python3.6/site-packages/ray/init.py", line 61, in
CDLL(so_path, ctypes.RTLD_GLOBAL)
File "/home/pi/.pyenv/versions/3.6.12/lib/python3.6/ctypes/init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: /home/pi/.pyenv/versions/3.6.12/lib/python3.6/site-packages/ray/_raylet.so: wrong ELF class: ELFCLASS64

@rodorio
Copy link
Author

rodorio commented Dec 22, 2020

Oh never mind, I got it working (used the wrong file haha). Thanks @PidgeyBE!

Would you happen to have the py_spy installer for aarch64? I want to try to get that working as well.

@PidgeyBE
Copy link
Contributor

PidgeyBE commented Dec 22, 2020

@rodorio Py spy and ray for python 3.6, aarch64:
[deleted]
Haven't tested them myself, but will do later today

//edit, this version should work:
ray-1.0.1-aarch64.zip

@rodorio
Copy link
Author

rodorio commented Dec 22, 2020

Really appreciate it @PidgeyBE, worked like a charm!

I'll play around with it and let you know how it goes.

edit: for anyone that might need it, regular "pip install" didnt work for me so I had to do "python -m pip install"

@benfred
Copy link

benfred commented Jan 17, 2021

py-spy has wheels for armv7/aarch64 on pypi now - you should be able to pip install it on a raspberry pi now: benfred/py-spy#328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants