<@ULVA73B9P> Hi all, I am going in circles with r...
# ask-marvin
m
@Marvin Hi all, I am going in circles with resolving the misconfiguration between prefect and pydantic. I have tried many versions, but currently failing with prefect 3.1.12 and pydantic 2.7.0 Using above config
Copy code
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`.
Tried reverting back to pydantic 1.10.11 as that's what we has used in the past.
Copy code
And because prefect (3.1.11) depends on pydantic (>=2.7,<2.10.0 || >2.10.0,<3.0.0)
 and prefect (3.1.13) depends on pydantic (>=2.9,<2.10.0 || >2.10.0,<3.0.0), prefect (>=3.0,<3.1.12 || >3.1.12,<3.1.14 || >3.1.14,<4.0) requires pydantic (>=2.7,<3.0.0).
And because prefect (3.1.14) depends on pydantic (>=2.9,<2.10.0 || >2.10.0,<3.0.0)
 and prefect (3.1.12) depends on pydantic (>=2.7,<2.10.0 || >2.10.0,<3.0.0), prefect (>=3.0,<4.0) requires pydantic (>=2.7,<3.0.0).
Reverting to prefect 2.20.X I get the following for any prefect cli or run.
Copy code
pydantic.v1.error_wrappers.ValidationError: 1 validation error for Profile
settings
  Unknown setting 'PREFECT_SERVER_ALLOW_EPHEMERAL_MODE'. (type=value_error)
m
Your message was too long by 191 tokens...
m
@Marvin esolving the misconfiguration between prefect and pydantic. I have tried many versions, but currently failing with prefect 3.1.12 and pydantic 2.7.0 Using above config
Copy code
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`.
m
It seems you're encountering an issue due to the deprecation of the
@root_validator
decorator in Pydantic 2.x. The error message suggests using
@model_validator
instead. Prefect 3.x has moved towards supporting Pydantic 2.x, which means you'll need to adapt your code accordingly. Here's what you can do: 1. Replace
@root_validator
with `@model_validator`:
Update your Pydantic models to use
@model_validator
for validation. This change is necessary because
@root_validator
is deprecated in Pydantic 2.x. 2. Ensure Compatibility: If you have custom Pydantic models that interact with Prefect, ensure they are compatible with Pydantic 2.x. The Prefect documentation suggests referring to Pydantic’s migration guide for detailed information on necessary changes. Pydantic Migration Guide. 3. Prefect and Pydantic Integration: For Prefect 3.x, custom validation should be explicitly handled in your flow. You can find more information on how to handle custom validation in Prefect's documentation. If you continue to face issues, consider checking Prefect's GitHub repository for any related issues or solutions. A recent pull request has moved several validators to an internal module to address these deprecations. You might want to keep an eye on Prefect's GitHub Issues for updates. Let me know if you need further assistance!
m
@Marvin
Reverting to prefect 2.20.X I get the following for any prefect cli or run.
Copy code
pydantic.v1.error_wrappers.ValidationError: 1 validation error for Profile
settings
  Unknown setting 'PREFECT_SERVER_ALLOW_EPHEMERAL_MODE'. (type=value_error)
n
hi @Mitch are you wanting to use pydantic 2.x and prefect 3.x?
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
.
this makes me think that somewhere in your code you are using a
root_validator
all of
prefect
3.x uses pydantic 2.x exclusively at this point, so that shouldn't be coming from us
m
I am trying to use either of them (probably 3.x) which allows to me to run and deploy. Let me just start from scratch on this one and rebuild to see if it is resolved
Will try to get to 3.x and pydantic 2.x
It was a prefect-aws versioning issue
👍 1