A runtime environment is a description of dependencies — Python packages, working directory, environment variables, container image — that Ray installs into a worker before running a task or actor.Documentation Index
Fetch the complete documentation index at: https://ray-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Define a runtime environment
Pass a dict toray.init, the runtime_env decorator argument, or .options(runtime_env=...).
Per-task and per-actor environments
Different tasks can need different dependencies. Specify per call:Supported fields
| Field | What it does |
|---|---|
pip | List of pip requirements, or a path to a requirements.txt. |
conda | Conda env YAML or named env. |
uv | Use uv for faster pip installs. |
working_dir | Local directory or remote URI; uploaded to workers. |
py_modules | List of local modules to ship to workers. |
env_vars | Environment variables to set in the worker. |
container | Run the worker in a Docker image. |
excludes | Paths to exclude from working_dir. |
Working directories
working_dir packages a local directory and ships it to every worker. Workers cd into the directory before running tasks, so relative imports and file paths work.
Caching
Ray caches resolved environments per node. The same set of pip packages is installed once per node; subsequent tasks reuse the venv.Container runtime envs
Container runtime envs require the cluster to have container runtime support enabled (such as Podman or
singularity).Best practices
Next steps
Configure
Cluster-wide configuration.
Cross-language
Mixing Python with Java and C++.