Cannot find redis module when initialize ray
When I import ray and initialize it, it raises ImportError.
>>> import ray
>>> ray.init()
7847:M 26 Jul 17:26:30.146 # Server started, Redis version 3.9.102
Waiting for redis server at 127.0.0.1:18517 to respond...
7848:M 26 Jul 17:26:30.260 # Server started, Redis version 3.9.102
Waiting for redis server at 127.0.0.1:12482 to respond...
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/ray/monitor.py", line 9, in <module>
import redis
ImportError: No module named redis
Allowing the Plasma store to use up to 6.87195GB of memory.
Starting local scheduler with 4 CPUs and 0 GPUs.
[INFO] (/Users/rkn/Workspace/ray/src/local_scheduler/local_scheduler.cc:219) Started worker with pid 7855
[INFO] (/Users/rkn/Workspace/ray/src/local_scheduler/local_scheduler.cc:219) Started worker with pid 7856
[INFO] (/Users/rkn/Workspace/ray/src/local_scheduler/local_scheduler.cc:219) Started worker with pid 7857
[INFO] (/Users/rkn/Workspace/ray/src/local_scheduler/local_scheduler.cc:219) Started worker with pid 7858
Failed to start the UI, you may need to run 'pip install jupyter'.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/ray/workers/default_worker.py", line 8, in <module>
import redis
ImportError: No module named redis
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/ray/workers/default_worker.py", line 8, in <module>
import redis
ImportError: No module named redis
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/ray/workers/default_worker.py", line 8, in <module>
import redis
ImportError: No module named redis
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/ray/workers/default_worker.py", line 8, in <module>
import redis
ImportError: No module named redis
{'node_ip_address': '127.0.0.1', 'redis_address': '127.0.0.1:18517', 'object_store_addresses': [ObjectStoreAddress(name='/tmp/plasma_store55413123', manager_name='/tmp/plasma_manager45879862', manager_port=30895)], 'local_scheduler_socket_names': ['/tmp/scheduler79047308']}
But when I manually import redis, everything is fine.
>>>import redis
>>>
@mitar
Are you installing ray with pip install ray or are you building ray from source?
The most likely problem is the one described in this comment https://github.com/ray-project/ray/issues/759#issuecomment-316831390 (i.e., that the workers are being started with a different version of python than the main python interpreter). That should be fixed in #760, so you can either use a more recent version of Ray (and build it from source), or just make sure that which python finds the version of Python that you are trying to use.
Let me know if that makes sense and/or solves the problem.
@wirehack any updates on this?
I am having trouble building ray from the source, but I tested it on another Linux which has only installed one version of python and it succeeded. So I think your solution is correct. I will close this issue but I'm hoping you can release a newer version of ray soon. Thanks!
@robertnishihara: We have more issues because of Ray using /usr/bin/python. For example, we have python3 only available inside our Docker, so Ray has issue executing it.
Could you maybe release a new version of Ray, with the fix made recently to master branch?
I'll build some wheels using the current master and post those here. We introduced some pretty big changes recently (in particular #692), so if that causes any unexpected problems, then I'll build wheels from an earlier commit.
A workaround we are currently using is to symlink /usr/bin/python to /usr/bin/python3 and this seems to work. (We have only one Python installed, system-wide. It is inside Docker, so we can do such ugly things.)
Can you try the attached wheels (whichever one is appropriate for the version of Python you are using).
I had to add the .zip in order to upload the wheels. You can use one of them as follows.
wget https://github.com/ray-project/ray/files/1195703/ray-0.1.2-cp36-cp36m-linux_x86_64.whl.zip
mv ray-0.1.2-cp36-cp36m-linux_x86_64.whl.zip ray-0.1.2-cp36-cp36m-linux_x86_64.whl # Remove the .zip
pip install ray-0.1.2-cp36-cp36m-linux_x86_64.whl
These were built from the commit dfcd399dbbf8c1f61050c2bfea60fd2b326f69b0 (two days ago).
ray-0.1.2-cp36-cp36m-linux_x86_64.whl.zip ray-0.1.2-cp35-cp35m-linux_x86_64.whl.zip ray-0.1.2-cp34-cp34m-linux_x86_64.whl.zip
Thanks! This works!
Great!
Just for reference, see also #806 for how to install Ray directly from git.