Ray is a unified open-source framework for building and scaling distributed applications and AI workloads in Python. It provides simple APIs for parallelizing Python functions and classes (tasks and actors) and a toolkit of specialized libraries (Ray Data, Train, Tune, Serve, RLlib) for machine learning. Ray offers a universal compute layer for orchestrating clusters, scheduling processes, fault tolerance, and autoscaling. The project maintains a very frequent release cadence, with minor and patch releases occurring every few weeks.
pip install rayVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic Ray Core usage, including initializing Ray, defining remote functions (tasks) using the `@ray.remote` decorator, launching these tasks with `.remote()`, and retrieving results with `ray.get()`. It includes an example of parallel execution with simulated delay.
Upgrade your Python environment to 3.10 or higher (e.g., `conda install python=3.10` or `pyenv install 3.10.13`).
Upgrade Pydantic to V2 (`pip install -U pydantic`) and update your code to use Pydantic V2 APIs. Consult the Pydantic migration guide and Ray's RFC on this change.
Review the Ray Train V2 Migration Guide (issues #49454 and REP) to adapt your training scripts. You can temporarily disable V2 by setting the environment variable `RAY_TRAIN_V2_ENABLED=0`.
If unexpected behavior or performance issues arise with Ray Data aggregations, you may need to explicitly configure the shuffle strategy to `ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.SORT_SHUFFLE_PULL_BASED` or re-evaluate your data pipeline.
For production deployments, enable token authentication as per Ray's security documentation to prevent unauthorized access and code execution.
Remove calls to `ray.get_dashboard_url()`. The dashboard URL is typically printed in the logs when Ray starts (e.g., '127.0.0.1:8265') or can be retrieved from the `ray.init()` return value if available.
Downgrade your Python environment to an officially supported version (e.g., Python 3.9, 3.10, 3.11, or 3.12 for current Ray versions). Check Ray's official documentation for supported Python versions and platform requirements.
Install the required component using pip: `pip install "ray[tune]"` (replace `tune` with the specific component needed).
Ensure `ray start --head` is running on the head node, verify the `--address` used in `ray.init()` is correct, and check firewall settings.
Start a Ray cluster using `ray start --head` before attempting to connect, or explicitly set `address=None` (default) in `ray.init()` to start a local Ray instance if no external cluster is intended.
Add `ray.init()` at the beginning of your script or program before using any Ray functions.