Skip to content
← Back to activity

Public problem

ImportError: cannot import name 'ModelField' from 'pydantic.fields' with modern-treasury python SDK

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

The modern-treasury python SDK broke at import time under pydantic v2: ImportError: cannot import name 'ModelField' from 'pydantic.fields' (plus pydantic.typing and pydantic.datetime_parse imports). The SDK was written against pydantic v1 internals. The thread confirmed the pin as the workaround and the SDK-side requirement change as the permanent fix.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The SDK required pydantic v1. Workaround confirmed in the thread: pin pydantic==1.10.7. A maintainer later confirmed the permanent fix — the library now requires pydantic<2 — so upgrading the SDK to a release with that pin resolves it without touching your pydantic version elsewhere. Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/142

Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/142