Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: cannot import name 'PDFTextSeq' from 'pdfminer.pdfdevice' #1308

Closed
user1823 opened this issue May 9, 2024 · 3 comments
Closed

[Bug]: cannot import name 'PDFTextSeq' from 'pdfminer.pdfdevice' #1308

user1823 opened this issue May 9, 2024 · 3 comments
Assignees
Labels

Comments

@user1823
Copy link

user1823 commented May 9, 2024

What were you trying to do?

ocrmypdf was working till recently. Now suddenly, I am seeing this error when trying to use it.

Where are you installing from?

PyPI (pip, poetry, pipx, etc.)

What operating system are you working on?

Windows

Relevant log output

C:\Users\User>ocrmypdf --version
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python312\Scripts\ocrmypdf.exe\__main__.py", line 4, in <module>
  File "C:\Program Files\Python312\Lib\site-packages\ocrmypdf\__init__.py", line 10, in <module>
    from ocrmypdf import helpers, hocrtransform, pdfa, pdfinfo
  File "C:\Program Files\Python312\Lib\site-packages\ocrmypdf\pdfinfo\__init__.py", line 9, in <module>
    from ocrmypdf.pdfinfo.info import Colorspace, Encoding, PageInfo, PdfInfo
  File "C:\Program Files\Python312\Lib\site-packages\ocrmypdf\pdfinfo\info.py", line 43, in <module>
    from ocrmypdf.pdfinfo.layout import LTStateAwareChar, get_page_analysis, get_text_boxes
  File "C:\Program Files\Python312\Lib\site-packages\ocrmypdf\pdfinfo\layout.py", line 23, in <module>
    from pdfminer.pdfdevice import PDFTextSeq
ImportError: cannot import name 'PDFTextSeq' from 'pdfminer.pdfdevice' (C:\Program Files\Python312\Lib\site-packages\pdfminer\pdfdevice.py)
@user1823
Copy link
Author

user1823 commented May 9, 2024

I fixed the issue by

  • uninstalling pdfminer and pdfminer.six,
  • running py -m pip cache purge, and then
  • reinstalling ocrmypdf.

I am not sure whether there is something that needs to be done on your part (e.g., improving the error message, adding more checks in the dependencies, etc.).

@jbarlow83
Copy link
Collaborator

Unless you have steps to reproduce this issue, I wouldn't know where to start to produce this issue.

@jbarlow83 jbarlow83 closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
@user1823
Copy link
Author

I don't have the exact reproduction steps but I think that this issue happened after I installed another package that had pdfminer as a dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants