facebookresearch / nougat

Implementation of Nougat Neural Optical Understanding for Academic Documents
https://facebookresearch.github.io/nougat/
MIT License
8.81k stars 561 forks source link

Python 3.9 support #114

Closed aandrukhovich closed 1 year ago

aandrukhovich commented 1 year ago

Hi, I noticed there's a Python 3.9+ requirement mentioned in the README,

image

but after installing via pip and running with Python 3.9.6, I encountered the following error:

Traceback (most recent call last):
  File "/Users/aa/Library/Python/3.9/bin/nougat", line 5, in <module>
    from predict import main
  File "/Users/aa/Library/Python/3.9/lib/python/site-packages/predict.py", line 17, in <module>
    from nougat import NougatModel
  File "/Users/aa/Library/Python/3.9/lib/python/site-packages/nougat/__init__.py", line 8, in <module>
    from .utils.dataset import NougatDataset
  File "/Users/aa/Library/Python/3.9/lib/python/site-packages/nougat/utils/dataset.py", line 21, in <module>
    from nougat.dataset.rasterize import rasterize_paper
  File "/Users/aa/Library/Python/3.9/lib/python/site-packages/nougat/dataset/rasterize.py", line 18, in <module>
    pdf: Path | bytes,
TypeError: unsupported operand type(s) for |: 'type' and 'type'

because this syntax was introduced in python 3.10. So, as I'm not sure what is better solution for you — update python version or maintain 3.9 support, I don't do any PR to it. Thank you!

lukas-blecher commented 1 year ago

Sorry about that. Fixed now Will release a new pypi version shortly