Skip to content

Unable to Load CpuMathNative #4483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samcode22 opened this issue Nov 16, 2019 · 8 comments
Closed

Unable to Load CpuMathNative #4483

samcode22 opened this issue Nov 16, 2019 · 8 comments
Assignees

Comments

@samcode22
Copy link

Exception thrown: 'System.DllNotFoundException' in Microsoft.ML.CpuMath.dll
An exception of type 'System.DllNotFoundException' occurred in Microsoft.ML.CpuMath.dll but was not handled in user code
Unable to load DLL 'CpuMathNative': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

the above error is shown at this line:
ModelOutput result = predEngine.Predict(input);

trying to implement sentimental analysis on input comments in ASP.NET WEB APPLICATION(.NET FRAMEWORK) but getting these error even though it is seen in solution explorer.
Solution platform is AnyCPU.also tried x64,x86 but no change.
Is there any other solution?

Originally posted by @samcode22 in #3764 (comment)

@eerhardt
Copy link
Member

Are you using Microsoft.ML v1.4.0? And are you using packages.config?

If so then check out the workarounds I posted here: #93 (comment)

I fixed this issue in the latest nightly builds, so it will be fixed in the next release. But you can use either work around in that link to get past this.

@samcode22
Copy link
Author

samcode22 commented Nov 17, 2019

Yes using Microsoft.ML v1.4.0 and using packages.config Tried Both the workarounds...1st was not allowed for my project and so tried 2nd adding the code in .csproj but still the error continues.Even I am able to see that CpuNative.dll on the specified path in packages folder but it is throws error that it is unable to load.

@eerhardt
Copy link
Member

Is the CpuMathNative.dll file copied to your output folder? Also - are you explicitly building for x64?

@srqdev
Copy link

srqdev commented Nov 18, 2019

I have the same issue (app is .NET 4.7.2 WPF) and the Microsoft.CPU.Math DLL is in the output folder but no CPU Native. The 2nd option does not work. I will try the first. When do we anticipate a bug release?

@samcode22
Copy link
Author

Exception thrown: 'System.BadImageFormatException' in Microsoft.ML.CpuMath.dll
An exception of type 'System.BadImageFormatException' occurred in Microsoft.ML.CpuMath.dll but was not handled in user code
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

The solution platform is able to run on AnyCPU and x86 but showing these error while x64 platform is not running..Where to change the format?

@eerhardt
Copy link
Member

@srqdev - You need to get the CpuMathNative.dll copied into your output folder. That's what the 2nd workaround is attempting to do in your .csproj. Note that you need to ensure the path to the assembly ..\packages is correct for your project, and adjust accordingly. Also note that you need to set PlatformTarget to either x86 or x64 - it can't be AnyCPU.

When do we anticipate a bug release?

@codemzs @gvashishtha - thoughts on shipping a patch for this?

@samcode22 - In the NuGet package there are 2 versions of the native assembly - one for 32-bit (x86) and one for 64-bit (x64). You need to ensure the 64-bit one is copied to your output folder if you are trying to run a 64-bit process.

@ashbhandare
Copy link
Contributor

@samcode22 Can you confirm that @eerhardt 's workaround fixed your issue?

@ashbhandare
Copy link
Contributor

Closing due to inactivity, please feel free to reopen.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants