ocrmypdf / OCRmyPDF

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched
http://ocrmypdf.readthedocs.io/
Mozilla Public License 2.0
14.12k stars 1.02k forks source link

[Bug]: cannot import name 'PdfMatrix' from 'pikepdf' #1406

Closed kdbreck closed 3 weeks ago

kdbreck commented 3 weeks ago

What were you trying to do?

Running ocrmypdf without options, I get this error:

ImportError: cannot import name 'PdfMatrix' from 'pikepdf' (~/.local/lib/python3.10/site-packages/pikepdf/init.py)

Where are you installing/running from?

Linux package manager (apt, dnf, etc.)

OCRmyPDF version

same error

What operating system are you working on?

Linux

Operating system details and version

Ubuntu 22.04

Simple sanity checks

Relevant log output

Traceback (most recent call last):
  File "/usr/bin/ocrmypdf", line 33, in <module>
    sys.exit(load_entry_point('ocrmypdf==13.4.0+dfsg', 'console_scripts', 'ocrmypdf')())
  File "/usr/bin/ocrmypdf", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/ocrmypdf/__init__.py", line 10, in <module>
    from ocrmypdf import helpers, hocrtransform, pdfa, pdfinfo
  File "/usr/lib/python3/dist-packages/ocrmypdf/pdfinfo/__init__.py", line 9, in <module>
    from ocrmypdf.pdfinfo.info import Colorspace, Encoding, PdfInfo
  File "/usr/lib/python3/dist-packages/ocrmypdf/pdfinfo/info.py", line 34, in <module>
    from pikepdf import (
jbarlow83 commented 3 weeks ago

The installed ocrmypdf is too new for the installed pikepdf -- update pikepdf to a newer version.