OneMoreGres / ScreenTranslator

Screen capture, OCR and translation tool.
MIT License
942 stars 122 forks source link

Linux Failed to init OCR Engine. #27

Closed ghost closed 4 years ago

OneMoreGres commented 4 years ago

Have you downloaded recognition langages from the settings window? What OS/app versions do you use? Enable 'write trace file' option and post log file here.

ghost commented 4 years ago

Recognition unable to click default lang. I can't change it, I am on ubuntu. There is file that you've asked. 2020-05-01T16:35:06 140668058914560 :0 WARN QXcbConnection: XCB error: 3 (BadWindow), sequence: 4972, resource id: 6883217, major code: 40 (TranslateCoords), minor code: 0 2020-05-01T16:35:16 140668058914560 :0 DEBUG captured Task(Gen=2, pix=QSize(887, 316), rec="", cor="", tr="", lang=-tur, err="") 2020-05-01T16:35:16 140667316459264 :0 CRIT Soft assertion failed at ../src/ocr/tesseract.cpp 125 : !language.isEmpty() 2020-05-01T16:35:16 140668058914560 :0 DEBUG recognized Task(Gen=2, pix=QSize(887, 316), rec="", cor="", tr="", lang=-tur, err="Failed to init OCR engine: ") 2020-05-01T16:35:16 140668058914560 :0 DEBUG finishTask Task(Gen=2, pix=QSize(887, 316), rec="", cor="", tr="", lang=-tur, err="Failed to init OCR engine: ") 2020-05-01T16:35:16 140668058914560 :0 CRIT "Failed to init OCR engine: " 2020-05-01T16:35:32 140668058914560 :0 DEBUG updateSettings

OneMoreGres commented 4 years ago

Download recognition languages from the settings window (updates page)

ghost commented 4 years ago

Now, I don't get that error message but I got new problem, WHen I capture anything it's dissapearing from system tray and closing itself. LOG : 2020-05-01T17:04:53 140445687443200 :0 DEBUG updateSettings 2020-05-01T17:04:59 140445687443200 :0 DEBUG captured Task(Gen=1, pix=QSize(68, 18), rec="", cor="", tr="", lang=eng-tur, err="")

OneMoreGres commented 4 years ago

Use the library from #25 . Also don't forget to download translators or yours next message will be about translation errors.

ghost commented 4 years ago

Sorry I am new I dont know where to put it, I've installed tess1.zip but I don't know where to put it

OneMoreGres commented 4 years ago

Put the archive's contents into the application's dir, replacing the existing file (tesseract41.dll)

ghost commented 4 years ago

I've looked all locations that listed below, I couldn't see .dll file in those directories, where should I put it? prefix=/usr/local exec_prefix=${prefix} bindir=${exec_prefix}/bin datarootdir = ${prefix}/share datadir=${datarootdir} libdir=${exec_prefix}/lib includedir=${prefix}/include

OneMoreGres commented 4 years ago

My mistake. Forgot that you're on ubuntu. Try the new appimage https://send.firefox.com/download/3064fa587a33f3d7/#QegGUuvxaUJgJR6r88M9Mw

ghost commented 4 years ago

Still same :(

OneMoreGres commented 4 years ago

Post output of cat /proc/cpuinfo | grep flags -m 1

ghost commented 4 years ago

Here you go flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer xsave rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust erms invpcid xsaveopt dtherm arat pln pts md_clear flush_l1d

OneMoreGres commented 4 years ago

Try this library (tess.linux.zip). Extract and run original appimage with LD_LIBRARY_PATH=<path_to_extracted_so> <original_appimage_file>

ghost commented 4 years ago

I extracted the library to /usr/local/lib and LD_LIBRARY_PATH=/usr/local/lib/libtesseract.so.4.1.1 /home/otakuch/ScreenTranslator-3.0.0.AppImage but it is still same. I've looked terminal: ` ./ScreenTranslator-3.0.0.AppImage

DevTools listening on ws://127.0.0.1:38577/devtools/browser/de87c611-3b71-46d3-9839-f21c2487e11e Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:38577 Illegal instruction (core dumped) `

OneMoreGres commented 4 years ago

LD_LIBRARY_PATH=/usr/local/lib /home/otakuch/ScreenTranslator-3.0.0.AppImage You can run lsof /usr/local/lib/libtesseract.so.4.1.1 after app start to check if this library is in use.

ghost commented 4 years ago

I did

 LD_LIBRARY_PATH=/usr/local/lib /home/otakuch/ScreenTranslator-3.0.0.AppImage

DevTools listening on ws://127.0.0.1:60669/devtools/browser/0e5244b0-c8dd-44af-8939-3b14ec7030da
Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:60669
"userscript:bing.js" : 22 "start translate LD_LIBRARY_PATH=\nYou can run\nuse. en tr"
"userscript:bing.js" : 34 "setting url https://www.bing.com/translator/?from=auto&to=tr&text=LD_LIBRARY_PATH%3D%0AYou%20can%20run%0Ause."
[10821:10848:0502/213614.013981:ERROR:nss_util.cc(674)] Error initializing NSS with a persistent database (sql:/home/otakuch/.pki/nssdb): libsoftokn3.so: cannot open shared object file: No such file or directory
[10821:10848:0502/213614.014026:ERROR:nss_util.cc(154)] Error initializing NSS without a persistent database: NSS error code: -5925
[10821:10848:0502/213614.014033:FATAL:nss_util.cc(156)] nss_error=-5925, os_error=0
OneMoreGres commented 4 years ago

Put downloaded .so to some separate dir (maybe under your home dir, not /usr/...). LD_LIBRARY_PATH tells app to start search for libs in a given folder. In /usr/../lib it can accidentally find and use some other libs, not just tesseract.

ghost commented 4 years ago

Still same :(

OneMoreGres commented 4 years ago

Looks like something else is broken and it's no more related to tesseract. I need some time to fix it

ghost commented 4 years ago

I guess it's searching wrong location for libsoftokn3.so, I don't know how to set up it to search /usr/lib/x86_64-linux-gnu/nss for libsoftokn3.so

OneMoreGres commented 4 years ago

Try LD_LIBRARY_PATH="/usr/local/lib:/usr/lib/x86_64-linux-gnu/nss" /home/otakuch/ScreenTranslator-3.0.0.AppImage as a workaround. Normally appimage should either find it inside appimage or do not search for it at all.

ghost commented 4 years ago

Not working sadly

OneMoreGres commented 4 years ago

Try this one with separate tesseract lib and LD_LIBRARY_PATH to it

ghost commented 4 years ago

I did LD_LIBRARY_PATH=/home/otakuch/ /home/otakuch/Downloads/ScreenTranslator-3.0.0.AppImage and it finally worked!

ghost commented 4 years ago

But how can I automatise LD command, because I want that app start auto from linux starting.

ghost commented 4 years ago

Also feature request, Imagine I ocr'ed "write" word, it can show other meanings too, I mean not just single meaning but someone won't like it so if as there were an option it would be great!

OneMoreGres commented 4 years ago

This appimage should work without tesseract lib and LD_LIBRARY_PATH. About alternative translations. I added it to a wish-list, but no promises.

Waltraute commented 4 years ago

This would be great if the link worked. Can you possibly put the file somewhere less transient? Thanks

OneMoreGres commented 4 years ago

I will publish the new version with fixes soon (likely this weekend). For now this is a release candidate for compatible version https://send.firefox.com/download/e34f0a031cbe7c13/#NSi-B875tPcPhpnb_szCEQ

Waltraute commented 4 years ago

Dear Sergey,

Thank you--I'm really impressed by the quick reply. Sadly I am still getting 'failure to init OCR engine'. with this version. I used to use the Windows version in Wine but for some reason it has stopped working. This is a great program--I seem to remember it was fine before I upgraded from Xenial to Bionic.

Any suggestions?

Elizabeth On 07/05/20 16:58, Sergey wrote:

I will publish the new version with fixes soon (likely this weekend). For now this is a release candidate for compatible version https://send.firefox.com/download/e34f0a031cbe7c13/#NSi-B875tPcPhpnb_szCEQ

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OneMoreGres/ScreenTranslator/issues/27#issuecomment-625342702, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPWDVQXTIGJPUNPGFTII23RQLLBNANCNFSM4MXCJGOA.

OneMoreGres commented 4 years ago

This error most likely means that program failed to find <lang>.tessdata file or this file's version is wrong. Have you installed required recogntion languages from the updates page of the settings window? And have you set default recognition language? You can also enable write trace file option and post the resulted file here/email me if nothing helps. Maybe it will help to find the cause.

Ubuntu version shouldn't really matter here since AppImage file already contains most of the required libraries.

Waltraute commented 4 years ago

Sorry--that was daft of me. Now everything works except, bizarrely, copy to clipboard, which just does nothing.

Thanks again for your kind help,

Elizabeth

On 07/05/20 17:24, Sergey wrote:

This error most likely means that program failed to find |.tessdata| file or this file's version is wrong. Have you installed required recogntion languages from the updates page of the settings window? And have you set default recognition language? You can also enable |write trace file| option and post the resulted file here/email me if nothing helps. Maybe it will help to find the cause.

Ubuntu version shouldn't really matter here since AppImage file already contains most of the required libraries.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OneMoreGres/ScreenTranslator/issues/27#issuecomment-625358185, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPWDVWMZOORLTFI7ECWWL3RQLOEDANCNFSM4MXCJGOA.

Waltraute commented 4 years ago

Dear Sergey,

I've finally got it right: if I change the 'representation' setting to 'window' it copies to the clipboard correctly. Thanks a million!

Elizabeth

On 07/05/20 17:24, Sergey wrote:

This error most likely means that program failed to find |.tessdata| file or this file's version is wrong. Have you installed required recogntion languages from the updates page of the settings window? And have you set default recognition language? You can also enable |write trace file| option and post the resulted file here/email me if nothing helps. Maybe it will help to find the cause.

Ubuntu version shouldn't really matter here since AppImage file already contains most of the required libraries.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OneMoreGres/ScreenTranslator/issues/27#issuecomment-625358185, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPWDVWMZOORLTFI7ECWWL3RQLOEDANCNFSM4MXCJGOA.

OneMoreGres commented 4 years ago

Glad to hear it works! I'll fix the clipboard. It should work with any representation type.