Error importing ray in colab due to pyarrow
See original GitHub issueSystem information
- colab
- pip install ray[rllib]
- python 3.7
Describe the problem
Very simple, just pip install ray, then import ray:
!pip install tensorflow # or tensorflow-gpu
!pip install ray[rllib] # also recommended: ray[debug]
import ray
on Google colab and it fails with:
ImportError: Ray must be imported before pyarrow because Ray requires a specific version of pyarrow (which is packaged along with Ray).
Recreate
Take a look at this gist running on colab
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to fix "ImportError: PyArrow >= 0.8.0 must be installed; ...
The error message in this case is misleading, pyarrow wasn't installed. ... pip uninstall pyarrow -y $ pip install pyarrow.
Read more >Issue might happen import PyArrow
Depending on your Linux OS, especially with Ubuntu, you might run into issue like, when you installed pyarrow by conda install. >>> import...
Read more >RLlib Tutorial - Colaboratory
print('NOTE: Intentionally crashing session to use the newly installed library.\n') !pip uninstall -y pyarrow !pip install ray[debug]==0.7.5
Read more >Installation — Modin 0.12.1+0.g34962ec.dirty documentation
Installing on Google Colab¶. Modin can be used with Google Colab via the pip command, by running the following code in a new...
Read more >5 Amazing Google Colab Hacks You Should Try Today
The 'out of memory' error is now quite infamous in the data science community – Google Colab provides us with the workaround and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for reporting this! This error happens because colab is preloading certain libraries (more on this below). To fix it, you can do the following:
and then click on
Runtime/Restart runtime
. After that, the Ray cell will work.Now as to why colab’s preloading is problematic: Ray depends on a library called pyarrow for serialization and some other things. Because TensorFlow’s binary package is not compliant with the manylinux1 standard [1], we need to ship a custom version of pyarrow that is compatible with TensorFlow. Until TensorFlow is fixed, we don’t really have a choice here, so sorry for that.
[1] https://groups.google.com/a/tensorflow.org/d/msg/developers/TMqRaT-H2bI/J1Wiu8_XCQAJ
Just a note - the way we get around this on our tutorial notebooks is by using this block of code before running anything: