cfculhane / AnkiOCR

Anki Addon to create searchable text from images in notes, using Tesseract OCR
MIT License
17 stars 5 forks source link

How I fixed my latest install error #35

Open thiswillbeyourgithub opened 2 years ago

thiswillbeyourgithub commented 2 years ago

Hi!

I recently did a fresh ubuntu reinstall my ankiOCR install was not working. I fixed it apparently and wanted to share it here.

The error appeared when running the OCR command and was the following:

Error encountered during processing. Debug info: 
Anki Version: 2.1.49 , AnkiOCR Version: 0.7.1
Platform: Linux , Python Version: 3.8.1 (default, Dec 21 2019, 15:35:48) 
[GCC 5.4.0 20160609]Traceback (most recent call last):
  File "/home/USER/.local/share/Anki2/addons21/450181164/gui.py", line 58, in on_run_ocr
    ocr.run_ocr_on_notes(note_ids=selected_nids)
  File "/home/USER/.local/share/Anki2/addons21/450181164/ocr.py", line 309, in run_ocr_on_notes
    notes_query = self.run_ocr_on_query(note_ids=note_ids)
  File "/home/USER/.local/share/Anki2/addons21/450181164/ocr.py", line 279, in run_ocr_on_query
    raw_results = self._ocr_batch_process(batched_txts=batched_txts)
  File "/home/USER/.local/share/Anki2/addons21/450181164/ocr.py", line 97, in _ocr_batch_process
    raw_results[batched_img_txt] = future.result()
  File "concurrent/futures/_base.py", line 432, in result
  File "concurrent/futures/_base.py", line 388, in __get_result
  File "concurrent/futures/thread.py", line 57, in run
  File "/home/USER/.local/share/Anki2/addons21/450181164/ocr.py", line 265, in _ocr_img
    return pytesseract.image_to_string(str(img_pth), lang="+".join(languages or ["eng"]),
  File "/home/USER/.local/share/Anki2/addons21/450181164/_vendor/pytesseract/pytesseract.py", line 416, in image_to_string
    return {
  File "/home/USER/.local/share/Anki2/addons21/450181164/_vendor/pytesseract/pytesseract.py", line 419, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "/home/USER/.local/share/Anki2/addons21/450181164/_vendor/pytesseract/pytesseract.py", line 287, in run_and_get_output
    run_tesseract(**kwargs)
  File "/home/USER/.local/share/Anki2/addons21/450181164/_vendor/pytesseract/pytesseract.py", line 263, in run_tesseract
    raise TesseractError(proc.returncode, get_errors(error_string))
450181164._vendor.pytesseract.pytesseract.TesseractError: (1, "/usr/local/bin/tesseract: /usr/local/share/anki/bin/liblzma.so.5: version `XZ_5.2' not found (required by /lib/x86_64-linux-gnu/libarchive.so.13)")

My fix was simple : cd /usr/local/share/anki/bin ; mv liblzma.so.5 liblzma.so.5_renamed_to_avoid_ankiOCR_crash_see_issue

Have a nice day and thanks a lot for the addon :)