question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't load tesseract dlls in Azure Function Environment

See original GitHub issue

Has anyone tried using Tesseract within Azure Functions? I installed the Tesseract nuget package 3.0.2.0 into my project. I have no issue running the project and loading Tesseract locally, but when I try and run it within the Azure Function container, I get the Failed to find library “liblept172.dll” for platform x86 error. I’ve spoke with a engineer at Microsoft, and they say that the VS C++ 2015 Redist are installed in the environment, and as far as I know, I am copying the DLLs to the correct location.

Here is the stack trace from the exception:

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)\r\n at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)\r\n at System.Activator.CreateInstance(Type type, Object[] args)\r\n at InteropDotNet.InteropRuntimeImplementer.CreateInstanceT\r\n at Tesseract.Interop.LeptonicaApi.Initialize()\r\n at Tesseract.Interop.TessApi.Initialize()\r\n at Tesseract.Interop.TessApi.get_Native()\r\n at Tesseract.TesseractEngine…ctor(String datapath, String language, EngineMode engineMode, IEnumerable1 configFiles, IDictionary2 initialOptions, Boolean setOnlyNonDebugVariables)\r\n at Tesseract.TesseractEngine…ctor(String datapath, String language, EngineMode engineMode)\r\n at ClFunctionsOcr.TesseractAPI.TesseractOcr.PerformOcr(List`1 images) in C:\Workspace\CLFunctions\CLFunctions\ClFunctionsOcr\TesseractAPI\TesseractOcr.cs:line 28

Inner Exception:

“Failed to find library "liblept172.dll" for platform x86.”

Anyone else have any trouble with this?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
AnQuethcommented, Jan 3, 2018

did you ever get thus working in a function app ?

0reactions
huzefaqubbawalacommented, Feb 14, 2020

I was able to use v4 (Tesseract-test 4.0.0-beta15) in Azure Functions v2. The only “hack” I had to do was to set CustomSearchPath as Az Func build ouptut has slightly different folder structure than normal netstandard project and the native DLLs are not where expected by default.

InteropDotNet.LibraryLoader.Instance.CustomSearchPath = Path.GetFullPath(PathToNetDlls + "\\..");

Can you please give me the details here . It would really help if you can attach the function.cs file.

I am trying to run the tessract in azure functions and getting strange issues. I also tried running tesseract.exe in azure function but no luck.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load unmanaged dll into azure function .net core
I am attempting to load an unmanaged vendor .dll file from Azure function using "DllImport" but It throws error "Unable to load DLL...
Read more >
Tesseract Fallback Logic
The fallback logic failed is thrown when the Microsoft Visual C++ Redistributable for Visual Studio is not installed on your target machines. Please...
Read more >
Debugging Azure Functions Project on Local Machine
Issue with Dependencies when Running Azure Functions locally​​ Only DLL files are copied to this directory, so software that requires additional files will...
Read more >
Unable to load DLL 'tesseract.dll'
Question: I having issues getting the Tesseract.Net library to locate the tesseract.dll in an MVC web project.
Read more >
Debugging Azure Functions Project on Local Machine
Problem: When running an Azure Function project locally, it creates an additional bin folder which it runs the function out of. However, it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found