Could not run Official tutorial with below Pydantic error

I was following the official ray-serve tutorial (
on a m2.2xlarge EC2. I’m using a python version 3.9. But getting the following error.
(pyvenv) [ec2-user@ip-server]$ serve run model_ray_serve:translator_app
Traceback (most recent call last):
File “/home/ec2-user/py3venv/pyvenv/bin/serve”, line 5, in
from ray.serve.scripts import cli
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 4, in
from ray.serve.api import (
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 19, in
from ray.serve.built_application import BuiltApplication
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 7, in
from ray.serve.deployment import Deployment
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 14, in
from ray.serve.context import get_global_client
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 12, in
from ray.serve._private.client import ServeControllerClient
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/_private/”, line 25, in
from ray.serve._private.deploy_utils import get_deploy_args
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/_private/”, line 8, in
from ray.serve.schema import ServeApplicationSchema
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 134, in
class DeploymentSchema(
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/ray/serve/”, line 242, in DeploymentSchema
def num_replicas_and_autoscaling_config_mutually_exclusive(cls, values):
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/pydantic/deprecated/”, line 222, in root_validator
return root_validator()(*__args) # type: ignore
File “/home/ec2-user/py3venv/pyvenv/lib64/python3.9/site-packages/pydantic/deprecated/”, line 228, in root_validator
raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True. Note that @root_validator is deprecated and should be replaced with @model_validator.

For further information visit Usage Errors - Pydantic
(pyvenv) [ec2-user@ip-server]$

Hey, i faced the same issue… got over it by deprecating pydantic version to 1.10.9

We’ve merged the changes to make Ray compatible with Pydantic 2.5+. You can start using Pydantic 2.5+ with Ray 2.9, which should be out at the end of December.

These changes should also be in the Ray nightly, so please feel free to try them out!