marker
marker copied to clipboard
ImportError: cannot import name 'field_validator' from 'pydantic'
Python 3.9.16 Name: pydantic Version: 1.10.10
Traceback (most recent call last):
File "/marker/convert_single.py", line 3, in <module>
from marker.convert import convert_single_pdf
File "/marker/marker/convert.py", line 3, in <module>
from marker.cleaners.table import merge_table_blocks, create_new_tables
File "/marker/marker/cleaners/table.py", line 2, in <module>
from marker.schema import Line, Span, Block, Page
File "/marker/marker/schema.py", line 4, in <module>
from pydantic import BaseModel, field_validator
ImportError: cannot import name 'field_validator' from 'pydantic' (/opt/conda/lib/python3.9/site-packages/pydantic/__init__.cpython-39-x86_64-linux-gnu.so)
I tried changing it to from pydantic.functional_validators import field_validator, but that doesn't work either.
This issue can be solved by pip install -U pydantic which upgrades to 2.5.3, although it results in:
fastapi 0.88.0 requires pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2, but you have pydantic 2.5.3 which is incompatible.