Installing Ray in Colab (via ! pip)?


  1. Is there a way to install Ray in colab? That is, Colab lets people run commands like ! ls and then ! pip install ray. However, ray says it requires a reboot. Do you know of a way to ‘simulate’ that in colab?

I was able to install Ray on my local host successfully.

  1. Is there a minimum level of Python it runs with? (That is - will it run with 3.7?)

Thank you.


Rich Katz

Hi. Here I go trying to suggest an answer to my own question but possibly this works in colab.

import os
os.kill(os.getpid(), 9)

Will that work for Ray?

Thanks so much.

Great project by the way.



@ Richard_Katz

I am just using Rllib from ray but I think it must be the same for you:

All you need to do for using Ray with Colab is running
!pip install -U ray in one cell

And then you restart the environment by clicking on “Restart Runtime”. See here:

(If that’s what you mean with reboot)

After that you can use ray in your other cells without running the cell with ! pip install -U ray again.

I hope this is helpful :slight_smile:

1 Like