Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loose pydantic dependency breaks Prefect (since release of pydantic 2.0) #10143

Closed
4 tasks done
klayhb opened this issue Jul 3, 2023 · 1 comment · Fixed by #10144
Closed
4 tasks done

Loose pydantic dependency breaks Prefect (since release of pydantic 2.0) #10143

klayhb opened this issue Jul 3, 2023 · 1 comment · Fixed by #10144
Labels
bug Something isn't working

Comments

@klayhb
Copy link

klayhb commented Jul 3, 2023

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Prefect documentation for this issue.
  • I checked that this issue is related to Prefect and not one of its dependencies.

Bug summary

Prefect's dependency on the pydantic pacakge is defined as:

pydantic >= 1.10.0

this breaks Prefect upon the recent release of 2.0 which has breaking changes and is not backward compatible.

So unless I'm missing something (?) seems like Prefect is just not compatible with the new Pydantic, but does not enforce this.

Locally, i fixed by enforcing an older version of pydantic in my project, but this should probably be fixed at the requirement level

Reproduction

1. create a new poetry python project
2. add a dependency on prefect
3. try to run anything in prefect

Error

Traceback (most recent call last):
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/bin/prefect", line 5, in <module>
    from prefect.cli import app
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/prefect/__init__.py", line 37, in <module>
    from prefect.states import State
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/prefect/states.py", line 14, in <module>
    from prefect.client.schemas import State as State
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/prefect/client/schemas/__init__.py", line 4, in <module>
    from .actions import BlockTypeUpdate, StateCreate
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/prefect/client/schemas/actions.py", line 9, in <module>
    import prefect.client.schemas.objects as objects
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/prefect/client/schemas/objects.py", line 20, in <module>
    from prefect._internal.schemas.bases import ObjectBaseModel, PrefectBaseModel
  File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/prefect/_internal/schemas/bases.py", line 15, in <module>
    from pydantic import BaseModel, Field, SecretField
ImportError: cannot import name 'SecretField' from 'pydantic' (/Users/redacted/Library/Caches/pypoetry/virtualenvs/prefect-tool-nqGlPUR4-py3.9/lib/python3.9/site-packages/pydantic/__init__.py)

Versions

Version:             2.10.18
API version:         0.8.4
Python version:      3.9.15
Git commit:          cf177852
Built:               Thu, Jun 29, 2023 2:34 PM
OS/Arch:             darwin/x86_64
Profile:             default
Server type:         cloud

Additional context

Using poetry in my project (to manage deps), if it matters

@klayhb klayhb added bug Something isn't working status:triage labels Jul 3, 2023
jawnsy added a commit that referenced this issue Jul 3, 2023
Prefect is not yet compatible with Pydantic v2, and there are
backward-incompatible changes requiring migration, so pin our
requirements to v1 only for the time being.

Closes: #10143
@jawnsy jawnsy mentioned this issue Jul 3, 2023
4 tasks
@jawnsy
Copy link
Contributor

jawnsy commented Jul 3, 2023

Thanks for the report! We've pinned to pydantic v1 for now, which should resolve this issue for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants