Monogramm / erpnext_ocr

:snake: :alembic: Optical Character Recognition using tesseract within Frappe.
MIT License
80 stars 53 forks source link

Cannot install on erpnext production vm (version 12) #45

Closed Ravn10 closed 3 years ago

Ravn10 commented 3 years ago

Describe the bug Tried installing on fresh erpnext production vm (version 12) Getting following error

frappe@ubuntu:~/frappe-bench$ ./env/bin/pip install -q -U -e ./apps/erpnext_ocr 
  ERROR: Command errored out with exit status 1:
   command: /home/frappe/frappe-bench/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pb3cp890/tesserocr/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pb3cp890/tesserocr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ddx6_z85
       cwd: /tmp/pip-install-pb3cp890/tesserocr/
  Complete output (15 lines):
  pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path.\nPerhaps you should add the directory containing `tesseract.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'tesseract' found\n"
  Supporting tesseract v4.0.0
  Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 67108864}}
  running bdist_wheel
  running build
  running build_ext
  building 'tesserocr' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -I/home/frappe/frappe-bench/env/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
  tesserocr.cpp:663:10: fatal error: leptonica/allheaders.h: No such file or directory
   #include "leptonica/allheaders.h"
            ^~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for tesserocr
    ERROR: Command errored out with exit status 1:
     command: /home/frappe/frappe-bench/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pb3cp890/tesserocr/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pb3cp890/tesserocr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ywetg5om/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python3.6/tesserocr
         cwd: /tmp/pip-install-pb3cp890/tesserocr/
    Complete output (15 lines):
    pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path.\nPerhaps you should add the directory containing `tesseract.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'tesseract' found\n"
    Supporting tesseract v4.0.0
    Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 67108864}}
    running install
    running build
    running build_ext
    building 'tesserocr' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -I/home/frappe/frappe-bench/env/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
    tesserocr.cpp:663:10: fatal error: leptonica/allheaders.h: No such file or directory
     #include "leptonica/allheaders.h"
              ^~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/frappe/frappe-bench/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pb3cp890/tesserocr/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pb3cp890/tesserocr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ywetg5om/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python3.6/tesserocr Check the logs for full command output.
Ravn10 commented 3 years ago

https://github.com/sirfz/tesserocr/issues/169 this solved the issue Thanks