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

No package 'tesseract' found #17

Closed
farscape2012 opened this issue Aug 18, 2016 · 11 comments
Closed

No package 'tesseract' found #17

farscape2012 opened this issue Aug 18, 2016 · 11 comments

Comments

@farscape2012
Copy link

farscape2012 commented Aug 18, 2016

I tried to install tesserocr in Ubuntu. I got following error. I have installed tesseract already. I donot know why it can not find.

Can someone help me out ?

$tesseract -v
tesseract 3.03
 leptonica-1.70
  libgif 4.1.6(?) : libjpeg 8d : libpng 1.2.50 : libtiff 4.0.3 : zlib 1.2.8 : webp 0.4.0
$ CPPFLAGS=-I/usr/lib pip install tesserocr
  Using cached tesserocr-2.1.2.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/tesserocr.egg-info
    writing pip-egg-info/tesserocr.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/tesserocr.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/tesserocr.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/tesserocr.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-DEBtw3/tesserocr/setup.py", line 166, in <module>
        test_suite='tests'
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/home/eijmmmp/BCReader/.virtEnv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 195, in run
        self.find_sources()
      File "/home/eijmmmp/BCReader/.virtEnv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 222, in find_sources
        mm.run()
      File "/home/eijmmmp/BCReader/.virtEnv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 306, in run
        self.add_defaults()
      File "/home/eijmmmp/BCReader/.virtEnv/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 335, in add_defaults
        sdist.add_defaults(self)
      File "/home/eijmmmp/BCReader/.virtEnv/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 160, in add_defaults
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/lib/python2.7/distutils/cmd.py", line 311, in get_finalized_command
        cmd_obj = self.distribution.get_command_obj(command, create)
      File "/usr/lib/python2.7/distutils/dist.py", line 846, in get_command_obj
        cmd_obj = self.command_obj[command] = klass(self)
      File "/home/eijmmmp/BCReader/.virtEnv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 137, in __init__
        _Command.__init__(self, dist)
      File "/usr/lib/python2.7/distutils/cmd.py", line 64, in __init__
        self.initialize_options()
      File "/tmp/pip-build-DEBtw3/tesserocr/setup.py", line 120, in initialize_options
        build_args = package_config()
      File "/tmp/pip-build-DEBtw3/tesserocr/setup.py", line 59, in package_config
        raise Exception(error)
    Exception: Package tesseract was not found in the pkg-config search path.
    Perhaps you should add the directory containing `tesseract.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'tesseract' found
@sirfz
Copy link
Owner

sirfz commented Aug 18, 2016

You seem to have pkg-config installed but it's failing to find libtesseract for some reason. This shouldn't raise an Exception though since in your case you're manually specifying the library path. I'll fix this behavior and allow the setup to continue even if pkg-config fails to find the installed library.

In the mean time, if you wish to quickly solve this, comment out line 59 in the setup.py script and run the setup with your CPPFLAGS.

@farscape2012
Copy link
Author

farscape2012 commented Aug 19, 2016

Thanks for helping me debugging.
I got following errors after commenting out line 58-59 in setup:

$ python setup.py build_ext -I/usr/lib/
running build_ext
Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing tesseract.pc' to the PKG_CONFIG_PATH environment variable No package 'tesseract' found Package lept was not found in the pkg-config search path. Perhaps you should add the directory containinglept.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lept' found
Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
Supporting tesseract v
Traceback (most recent call last):
File "setup.py", line 166, in
test_suite='tests'
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 970, in run_command
cmd_obj = self.get_command_obj(command)
File "/usr/lib/python2.7/distutils/dist.py", line 846, in get_command_obj
cmd_obj = self.command_obj[command] = klass(self)
File "/home/eer/.virtEnv/local/lib/python2.7/site-packages/setuptools/init.py", line 137, in init
_Command.init(self, dist)
File "/usr/lib/python2.7/distutils/cmd.py", line 64, in init
self.initialize_options()
File "setup.py", line 120, in initialize_options
build_args = package_config()
File "setup.py", line 85, in package_config
config['cython_compile_time_env'] = {'TESSERACT_VERSION': version_to_int(version)}
File "setup.py", line 48, in version_to_int
version = re.search(r'((?:\d+.)+\d+)', version).group()
AttributeError: 'NoneType' object has no attribute 'group'

@sirfz
Copy link
Owner

sirfz commented Aug 19, 2016

I've pushed a fix to branch bugfix. Try installing it: https://github.com/sirfz/tesserocr/tree/bugfix

@sirfz
Copy link
Owner

sirfz commented Aug 22, 2016

Hey @farscape2012, did you get to try the suggested fix? If yes please let me know if it's working for you so I can merge it.

@audiolion
Copy link

Just tried the bugfix branch

tesserocr.cpp:414:10: fatal error: 'leptonica/allheaders.h' file not found
    #include "leptonica/allheaders.h"

so it ignored the error but then failed on actually trying to find those libs

@sirfz
Copy link
Owner

sirfz commented Oct 29, 2016

@audiolion the setup script tries to use the pkg-config to find the location of the tesseract and leptonica include paths, if that fails then it relies on your system's environment (or the environment variables you specified while running the script). In your case, the script failed to locate the leptonica headers.

Have you tried manually passing the necessary flags as suggested in the README?

CPPFLAGS=-I/usr/local/include pip install tesserocr

@audiolion
Copy link

yes that was with the flags passed, I am on MAC osx and you said you didn't test or guarantee anything, just wanted to pass on my results as the previous participant didn't follow up

@sirfz
Copy link
Owner

sirfz commented Oct 30, 2016

The bugfix is related to the handling of pkg-config failure which shouldn't crash the setup, however in your case your problem seems to be the CPPFLAGS since the compiler is failing to find the headers. Basically, the setup did try to go ahead and compile the generated cpp file even though (I assume) pkg-config failed to find the libraries.

Make sure /usr/local/include (or whatever path you're specifying) contains a folder called leptonica which in turn contains a file called allheaders.h.

@sirfz sirfz closed this as completed Apr 29, 2017
@venkatakrishnan-data
Copy link

I used OCR to create a simple shiny app while deploying I got the following error.
As a beginner in R, I am unsure if its a bug. Please help me with this error.
image

@Piterden
Copy link

I have solved it installing next:

apt install tesseract-ocr* liblept5 leptonica-progs libleptonica-dev

@mateoradman
Copy link

I ran into the same problem today on Ubuntu 22.04 and after running sudo apt install liblept5 leptonica-progs libleptonica-dev libtesseract-dev, it worked.

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

No branches or pull requests

6 participants