I built a ray docker with a dockerfile like this:
FROM rayproject/ray:2.9.1-py310-cpu
... copy requirements.txt and create an env named "production"
RUN conda create -n production --file $HOME/requirements.txt -y
To test it, I start it with docker run
.
Inside the docker I do ray start --head
, then open a python console to connect to it with ray.init("auto", runtime_env={"conda": "production"})
Now an arbitrary function like this
@ray.remote
def f(): pass
will fail:
(raylet) Traceback (most recent call last):
(raylet) File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/workers/default_worker.py", line 7, in <module>
(raylet) import ray
(raylet) ModuleNotFoundError: No module named 'ray'
(raylet) [2024-01-23 16:17:46,643 E 470 470] (raylet) worker_pool.cc:553: Some workers of the worker process(7966) have not registered within the timeout. The process is dead, probably it crashed during start.
Did I miss anything? Is this way of specifying conda env correct?
Many thanks.