VikParuchuri / marker

Convert PDF to markdown quickly with high accuracy
https://www.datalab.to
GNU General Public License v3.0
17.65k stars 1.01k forks source link

unsupported operand type(s) for |: '_GenericAlias' and 'NoneType' #265

Closed YuChuanhui3 closed 3 weeks ago

YuChuanhui3 commented 2 months ago
(marker) PS D:\pdf> python -V
Python 3.9.19
(marker) PS D:\pdf> python
Python 3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.4.0+cpu'
>>> exit()
(marker) PS D:\pdf> marker ./ ./
Traceback (most recent call last):
  File "C:\Users\16554\.conda\envs\marker\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\16554\.conda\envs\marker\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\16554\.conda\envs\marker\Scripts\marker.exe\__main__.py", line 4, in <module>
  File "C:\Users\16554\.conda\envs\marker\lib\site-packages\convert.py", line 13, in <module>
    from marker.convert import convert_single_pdf
  File "C:\Users\16554\.conda\envs\marker\lib\site-packages\marker\convert.py", line 12, in <module>
    from marker.tables.table import format_tables
  File "C:\Users\16554\.conda\envs\marker\lib\site-packages\marker\tables\table.py", line 3, in <module>
    from marker.schema.page import Page
  File "C:\Users\16554\.conda\envs\marker\lib\site-packages\marker\schema\page.py", line 6, in <module>
    from surya.schema import TextDetectionResult, LayoutResult, OrderResult
  File "C:\Users\16554\.conda\envs\marker\lib\site-packages\surya\schema.py", line 141, in <module>
    class OCRResult(BaseModel):
  File "C:\Users\16554\.conda\envs\marker\lib\site-packages\surya\schema.py", line 143, in OCRResult
    languages: List[str] | None = None
TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'NoneType'

acandon 环境下报错:

GLambard commented 2 months ago

Upgrading my environment to Python 3.10 did the trick! I hope it helps you.

YuChuanhui3 commented 2 months ago

Upgrading my environment to Python 3.10 did the trick! I hope it helps you.

Thank you very much, the issue has been resolved

VikParuchuri commented 3 weeks ago

I dropped py3.9 support, so this should be resolved - also had to update a lot of dependencies