sirfz / tesserocr

A Python wrapper for the tesseract-ocr API
MIT License
2.02k stars 254 forks source link

Failed building wheel for tesserocr #169

Closed samkit-jain closed 5 years ago

samkit-jain commented 5 years ago

When doing pip install tesserocr:

Building wheels for collected packages: tesserocr
  Running setup.py bdist_wheel for tesserocr ... error
  Complete output from command /home/samkitjain/miniconda3/envs/pdfengine/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-5xltz4rt/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-imqmgnqv --python-tag cp36:
  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
  gcc -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/include -fPIC -I/home/samkitjain/miniconda3/envs/pdfengine/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
  tesserocr.cpp:654:10: fatal error: tesseract/publictypes.h: No such file or directory
   #include "tesseract/publictypes.h"
            ^~~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for tesserocr
$ tesseract -v
tesseract 4.0.0-136-g40e1
 leptonica-1.76.0
  libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.2) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0
 Found AVX2
 Found AVX
 Found SSE
samkit-jain commented 5 years ago

Installed tesseract using the PPA: https://launchpad.net/~alex-p/+archive/ubuntu/tesseract-ocr OS: Ubuntu 18.04.1 LTS

sirfz commented 5 years ago

try installing pkg-config apt install pkg-config before installing tesserocr.

samkit-jain commented 5 years ago

Already have pkg-config installed.

$ sudo apt install pkg-config
Reading package lists... Done
Building dependency tree       
Reading state information... Done
pkg-config is already the newest version (0.29.1-0ubuntu2).
sirfz commented 5 years ago

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"

You also need to install libtesseract-dev and libleptonica-dev as specified in the requirements.

samkit-jain commented 5 years ago

Installing libleptonica-dev from the same PPA solved it. Thank you!