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

akhil patel 1 Reputation point
2021-10-04T13:56:43.687+00:00

I am trying to run an sklearn onnx model in C# 4.8 framework on Windows 10 Pro with VS 2019, I have used the following code using examples in:

https://towardsdatascience.com/deploy-sci-kit-learn-models-in-net-core-applications-90e24e572f64

https://vkontech.com/making-predictions-in-c-with-a-pre-trained-tensorflow-model-via-onnx/

and

https://learn.microsoft.com/en-us/azure/machine-learning/how-to-use-automl-onnx-model-dotnet

I also have looked at a similar answer here:

https://learn.microsoft.com/answers/questions/304053/entrypointnotfoundexception-unable-to-find-an-entr.html

I have imported using nuget

Install-Package Microsoft.ML.OnnxRuntime -Version 1.9.0
Install-Package Microsoft.ML.OnnxRuntime.Gpu -Version 1.9.0
Install-Package Microsoft.ML.OnnxTransformer -Version 1.6.0
Install-Package Microsoft.ML.OnnxRuntime.MKLML -Version 1.6.0
Install-Package Microsoft.ML -Version 1.5.5
when i run this line of code:

InferenceSession session = new InferenceSession(modelPath);
I receive this 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'.

in:

public SessionOptions()
: base(IntPtr.Zero, true)
{
NativeApiStatus.VerifySuccess(NativeMethods.OrtCreateSessionOptions(out handle));
}

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,640 questions
.NET Machine learning
.NET Machine learning
.NET: Microsoft Technologies based on the .NET software framework.Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.
154 questions
0 comments No comments
{count} votes