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

Programmatic Prefect Deployment encounters pydantic unexpected keyword argument 'field_specifiers' #8683

Open
4 tasks done
johnkangw opened this issue Mar 1, 2023 · 3 comments
Labels
bug Something isn't working maintenance Chores and other work not directly related to the product status:accepted We may work on this; we will accept work from external contributors

Comments

@johnkangw
Copy link

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

When I try to deploy a Prefect flow programmatic I encounter a TypeError stating that the dataclass_transform() got an unexpected keyword argument 'field_specifiers'.

Reproduction

if __name__ == "__main__":
    capacity_data_update_deployment.apply()
    print("Capacity Data Update Deployment Applied")
    remove_previous_temporary_directory_deployment.apply()
    print("Remove Previous Temporary Directory Deployment Applied")

Error

Traceback (most recent call last):
  File "C:\Users\JKANG1\PycharmProjects\Manheim_Capacity\main_python_files\prefect_capacity_deployment.py", line 5, in <module>
    from prefect.deployments import Deployment
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\__init__.py", line 25, in <module>
    from prefect.states import State
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\states.py", line 14, in <module>
    from prefect.client.schemas import State as State
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\client\schemas.py", line 4, in <module>
    from pydantic import Field
  File "pydantic\__init__.py", line 2, in init pydantic.__init__
  File "pydantic\dataclasses.py", line 47, in init pydantic.dataclasses
    # +=========+=========================================+
  File "pydantic\main.py", line 121, in init pydantic.main
TypeError: dataclass_transform() got an unexpected keyword argument 'field_specifiers'

Process finished with exit code 1

Versions

I cannot run prefect version and I encounter this error (running Prefect 2.8.3):

(Capacity_venv) C:\WINDOWS\system32>prefect version
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\Scripts\prefect.exe\__main__.py", line 4, in <module>
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\__init__.py", line 25, in <module>
    from prefect.states import State
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\states.py", line 14, in <module>
    from prefect.client.schemas import State as State
  File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\client\schemas.py", line 4, in <module>
    from pydantic import Field
  File "pydantic\__init__.py", line 2, in init pydantic.__init__
  File "pydantic\dataclasses.py", line 47, in init pydantic.dataclasses
    # +=========+=========================================+
  File "pydantic\main.py", line 121, in init pydantic.main
TypeError: dataclass_transform() got an unexpected keyword argument 'field_specifiers'

(Capacity_venv) C:\WINDOWS\system32>

(Capacity_venv) C:\WINDOWS\system32>prefect version
Version:             2.8.3
API version:         0.8.4
Python version:      3.8.13
Git commit:          07de1ac4
Built:               Thu, Feb 23, 2023 4:31 PM
OS/Arch:             win32/AMD64
Profile:             new_dell
Server type:         cloud

Additional context

I was actually able to resolve this issue by downgrading pedantic from 1.10.5 to 1.10.2. Not sure if this is an issue with pydantic or prefect...

@johnkangw johnkangw added bug Something isn't working status:triage labels Mar 1, 2023
@serinamarie
Copy link
Contributor

Hi @johnkangw, thanks for the issue! This looks like a pydantic / typing-extensions version incompatibility to me and might be fixed by pinning our typing-extensions version in our requirements.txt.

@serinamarie serinamarie added status:accepted We may work on this; we will accept work from external contributors priority:medium labels Mar 3, 2023
@serinamarie serinamarie added maintenance Chores and other work not directly related to the product status:triage and removed status:triage labels Mar 3, 2023
@johnkangw
Copy link
Author

@serinamarie Thanks for the heads up! Got it!

@zanieb
Copy link
Contributor

zanieb commented Mar 3, 2023

I'm not sure we should adjust our pins here since this is just an upstream incompatibility. It's generally best to leave our requirements as unconstrained as possible. I'd love to hear if more people encounter this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maintenance Chores and other work not directly related to the product status:accepted We may work on this; we will accept work from external contributors
Projects
None yet
Development

No branches or pull requests

4 participants