EntryPointNotFoundException: Unable to find an entry point named 'OrtGetApiBase' in DLL 'onnxruntime'.

Ratan Kumar Prajapati 1 Reputation point
2021-03-08T14:56:43.083+00:00

I want to make prediction using azure AutoML onnx model in .net core(3.1) console application in visual studio. I have exported onnx model from azure AutoML.

I am following the tutorial link : https://learn.microsoft.com/en-us/azure/machine-learning/how-to-use-automl-onnx-model-dotnet

It says to install following packages (in parenthesis shows the version I am using)
Microsoft.ML (1.5.4)
Microsoft.ML.OnnxRuntime(1.7.0)
Microsoft.ML.OnnxTransformer(1.5.4)

while defining the pipeline
var onnxPredictionPipeline =mlContext.Transforms.ApplyOnnxModel(
outputColumnNames: outputColumns,
inputColumnNames: inputColumns,
ONNX_MODEL_PATH);

I am getting the following error :
System.TypeInitializationException: 'The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.'
EntryPointNotFoundException: Unable to find an entry point named 'OrtGetApiBase' in DLL 'onnxruntime'.

Then I tried with Microsoft.ML.OnnxRuntime.Managed(1.7.1) along with above packages but still getting the same issue.

Please suggest to resolve this issue.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
1,866 questions
{count} votes

4 answers

Sort by: Most helpful
  1. rakibul Islam 6 Reputation points
    2021-06-03T05:43:45.307+00:00

    In my environment I reproduce the issue after uninstall below redistributable package from control panel.

    Microsoft Visual C++ 2015-2019 Redistributable (x64) -14.29....
    Microsoft Visual C++ 2015-2019 Redistributable (x86) -14.29....

    My OS is Windows 10, Visual Studio 2019

    and installing again this package may solve the issue.

    https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
    Direct Link:
    https://aka.ms/vs/16/release/vc_redist.x86.exe
    and
    https://aka.ms/vs/16/release/vc_redist.x64.exe

    please install those if not install. And try .
    If doesn't work Then Install all C++ for Desktop from Visual Studio Installer.

    1 person found this answer helpful.

  2. Ratan Kumar Prajapati 1 Reputation point
    2021-03-23T11:11:19.33+00:00

    Hi,
    I included the following packages:

    Microsoft.ML (1.5.5)
    Microsoft.ML.OnnxRuntime.Managed(1.7.1)
    Microsoft.ML.OnnxRuntime.MKLML(1.6.0)
    Microsoft.ML.OnnxTransformer(1.5.5)

    It is working now.

    0 comments No comments

  3. Mattia Fabi 1 Reputation point
    2021-05-13T10:30:20.437+00:00

    Hi,
    I included those packages but I am still getting the same error.
    Has anyone else having the same error message and managed to fix it? I read someone else talking about cuda version non compatible, but I don't know what I should do to fix it... Any idea?

    0 comments No comments

  4. T.Mei 1 Reputation point
    2022-11-15T11:42:03.173+00:00

    260506-image.png

    I solved the issue by change Bitness to X64 in project properties --> Web --> Servers.

    0 comments No comments