microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.26k stars 2.87k forks source link

The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception #13744

Closed tungfpmss closed 3 weeks ago

tungfpmss commented 1 year ago

Describe the issue

Hello everyone! Currently I have problem when deploying Onnx with windows 7 x64 professional sp1 (on windows 10 it works properly) I installed and used:

But when running on windows 7 error as below: Unable to load DLL 'onnxruntime': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Microsoft.ML.OnnxRuntime.NativeMethods.OrtGetApiBase() The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception. Do you have any suggestions for me in this case? Am i missing something?

To reproduce

using Microsoft.ML.OnnxRuntime;

try { InferenceSession _session = new InferenceSession(_path_Weight); // cannot load } catch (Exception _ex) { //Exception - issue }

Urgency

No response

Platform

Windows

OS Version

Windows 7 x64 professional sp1

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.13.1

ONNX Runtime API

C#

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

yuslepukhin commented 1 year ago

Check this first.

Steven-L-42 commented 1 year ago

Have still the same problem.

yuslepukhin commented 1 year ago

There is a fix for a similar issue in 1.15.1

iperov commented 1 year ago

same, onnxruntime.dll loaded from system32 which is outdated and from 2019 year Procmon64_2023-07-22_15-52-12

aayush0419 commented 4 months ago

I am facing similar issue. Did you manage to fix this?

tungfpmss commented 3 weeks ago

I am facing similar issue. Did you manage to fix this?

Hi. I found a way to fix this error: use onnxruntime.dll version 1.6.0 (File version: 1.6.20.12.09 - Date modified: 10/12/2020). Because this version does not have missing files dependent on windows 7.

tungfpmss commented 3 weeks ago

I found a way to fix this error: use onnxruntime.dll version 1.6.0 (File version: 1.6.20.12.09 - Date modified: 10/12/2020). Because this version does not have missing files dependent on windows 7. And using Microsoft.ML.OnnxRuntime.dll 1.6.0 (Date modified: 22/10/2022)

512286910 commented 1 week ago

你好,这个问题解决没,遇到同样问题了