https://prefect.io logo
a

Ankit

07/05/2023, 3:56 PM
Hi, we have suddenly getting these errors in our cluster
ImportError: cannot import name 'SecretField' from 'pydantic' (/usr/local/lib/python3.8/dist-packages/pydantic/__init__.py)
โœ… 1
c

Christopher Boyd

07/05/2023, 4:57 PM
that looks like an import error with Pydantic
Did your package installs change recently?
n

Nikhil Jain

07/05/2023, 8:39 PM
We started getting this too. No dependencies changed on our end.
๐Ÿ‘€ 1
c

Christopher Boyd

07/05/2023, 8:41 PM
are you using a default prefect image? are you using a pinned version, or latest?
n

Nikhil Jain

07/05/2023, 8:42 PM
For our flows, we are using a pinned version.
prefect==2.8.0
For the prefect-agent (running in AWS) we are using the latest image.
c

Christopher Boyd

07/05/2023, 8:46 PM
are you installing pydantic?
Iโ€™m not sure if itโ€™s something that changed in container, or in the build or elsewhere - checking Pydantic, https://docs.pydantic.dev/dev-v2/changelog/#v1100-2022-08-30
Copy code
v1.10.0 - 2022-08-30 - Adds the SecretField abstract class so that all the current and future secret fields like SecretStr and SecretBytes will derive from it, #3409 by @expobrain
n

Nate

07/06/2023, 8:22 PM
did we figure this out? those docs linked are for pydantic v2 which is very different (written in rust etc) perhaps an upper bound
pydantic<2.0
would be a temporary fix - i would anticipate prefect breaking if it tried to use v2, but we have an upper bound
perhaps the agent is spawning jobs that don't pin and are pulling pydantic v2
a

Ankit

07/07/2023, 11:44 AM
I explicitly added pydantic==1.10.6 to fix this
We use prefect 2.8.4 pinned tag, just started breaking but fixed with ^
๐Ÿ™Œ 1
t

Tom Klein

07/10/2023, 7:18 AM
itโ€™s breaking since the release of Pydantic 2. this issue has been fixed in the latest releases of Prefect
๐Ÿ‘ 2
๐Ÿ™Œ 1
174 Views