O
O
ohuevshiy2020-02-18 03:22:01
Python
ohuevshiy, 2020-02-18 03:22:01

Error when installing tesseract-ocr module, how to solve?

Hello!
I ran into a problem, I'm trying to install the tesseract-ocr module via the command line. An error of the following nature appears:

ERROR: Command errored out with exit status 1:
     command: 'c:\users\ohvshiy\pars\avitovagon\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Ohvshiy\AppData\Local\Temp\pip-record-o8dmzbeq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\ohvshiy\pars\avitovagon\include\site\python3.7\tesseract-ocr'
         cwd: C:\Users\Ohvshiy\AppData\Local\Temp\pip-install-_cm9i1xq\tesseract-ocr\
    Complete output (14 lines):
    running install
    running build
    running build_py
    file tesseract_ocr.py (for module tesseract_ocr) not found
    file tesseract_ocr.py (for module tesseract_ocr) not found
    running build_ext
    building 'tesseract_ocr' extension
    creating build
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\ohvshiy\pars\avitovagon\include -IC:\Users\Ohvshiy\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\Ohvshiy\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" /EHsc /Tptesseract_ocr.cpp /Fobuild\temp.win32-3.7\Release\tesseract_ocr.obj
    tesseract_ocr.cpp
    tesseract_ocr.cpp(631): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«о祭ЁҐ: leptonica/allheaders.h: No such file or directory,
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\ohvshiy\pars\avitovagon\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Ohvshiy\AppData\Local\Temp\pip-record-o8dmzbeq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\ohvshiy\pars\avitovagon\include\site\python3.7\tesseract-ocr' Check the logs for full command output.


After climbing the Internet, following the advice, I installed Microsoft Visual Studio 2019, and in it MSVCv142 - VS 2019 C ++ x64 / x86 build tools and Windows 10 SDK, I also tried to install the module not only through pip, but also easy_install.
The problem remained, I saw that a similar topic was created here a year ago, but from the only answer - I still didn’t understand anything)

I’ll attach a screen from the Visual Studio Installer, so for some reason there is no Python column, you can also see all the components installed, if it’s like something will help the cause:
5e4bb7173269a033731172.png

Help me out, for the second day I have been racking my brains about what he needs from me, Thank you in
advance to all who responded!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Foxcloud Foxcloud, 2020-02-18
@FoxCloud

Hello!
Try another method to install via Anaconda
1. Install anaconda https://www.anaconda.com/download/#windows
2. Open anaconda command line and type in two commands:
conda create -n OCR python=3.6
activate OCR
3. Install tesseract
conda install -c simonflueckiger tesserocr

D
Danil K., 2020-02-18
@Danya_Violet

one
two: pip install pytesseract pillow
example:

from PIL import Image
import pytesseract

pytesseract.pytesseract.tesseract_cmd = r'C:\Users\Violet\AppData\Local\Tesseract-OCR\tesseract.exe'

print(pytesseract.image_to_string(Image.open(r'img\driver_fr\777.jpg'), lang="rus"))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question