penteract-ocr icon indicating copy to clipboard operation
penteract-ocr copied to clipboard

install on linux?

Open terry-fei opened this issue 6 years ago • 4 comments

can this module install on ubuntu?

terry-fei avatar Sep 09 '17 11:09 terry-fei

No, for now, but I will working on that.

On Ubuntu, the version of tesseract binary of apt-get source is 3.04, which is out-dated.

And version 3.04 will cause a problem that pkg-config could not find the location of headers files of tesseract, see tesseract-ocr/tesseract#241 .

And the only possible way is to manually install tesseract from source code.

kaelzhang avatar Sep 09 '17 13:09 kaelzhang

provide a Docker image may be a good choice

terry-fei avatar Sep 10 '17 02:09 terry-fei

Which tesseract version does penteract expect? I've tied 4.00.00alpha, but got:

make: Entering directory '/databank/mega/development/js/img_recognition/node_modules/penteract/build'
  CXX(target) Release/obj.target/penteract/cc/penteract.o
  CXX(target) Release/obj.target/penteract/cc/ocr.o
In file included from /usr/local/include/tesseract/ltrresultiterator.h:26:0,
                 from /usr/local/include/tesseract/resultiterator.h:26,
                 from /usr/local/include/tesseract/baseapi.h:31,
                 from ../cc/ocr.h:4,
                 from ../cc/ocr.cc:1:
/usr/local/include/tesseract/unichar.h:164:10: error: ‘string’ does not name a type
   static string UTF32ToUTF8(const std::vector<char32>& str32);
          ^
penteract.target.mk:100: recipe for target 'Release/obj.target/penteract/cc/ocr.o' failed
make: *** [Release/obj.target/penteract/cc/ocr.o] Error 1
make: Leaving directory '/databank/mega/development/js/img_recognition/node_modules/penteract/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/i/.nvm/versions/node/v8.6.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-101-generic
gyp ERR! command "/home/i/.nvm/versions/node/v8.6.0/bin/node" "/home/i/.nvm/versions/node/v8.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /databank/mega/development/js/img_recognition/node_modules/penteract
gyp ERR! node -v v8.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/i/.npm/_logs/2017-12-22T23_11_46_972Z-debug.log

02:11 i img_recognition ●  

To fix that I added "std::" to "string" on /usr/local/include/tesseract/unichar.h:164.

dortonway avatar Dec 22 '17 23:12 dortonway

$ sudo apt install tesseract-ocr tesseract-ocr-eng libtesseract-dev libleptonica-dev

Piterden avatar Feb 10 '18 05:02 Piterden