dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9k stars 1.88k forks source link

System.DllNotFoundException: Unable to load DLL 'CpuMathNative' #333

Closed prisar closed 5 years ago

prisar commented 6 years ago

System information

Issue

jusso-dev commented 6 years ago

Change your project to compile to 64x, CpuMathNative is a 64x run time dependant library

chrismckelt commented 6 years ago

Did you run build.cmd before running it? I got this issue & needed to pull the solution down again & rerun build.cmd to be able to correctly build the solution

jusso-dev commented 6 years ago

That's probably solving the same issue. If building the project outside of a 64x runtime it won't work, point blank.

chrismckelt commented 6 years ago

An AnyCPU assembly will JIT to 64 bit code when loaded into a 64 bit process and 32 bit when loaded into a 32 bit process so no need to change I think - I had this on Windows Server 2016 Standard & reinstalled the tools & all was good

PaulDMendoza commented 6 years ago

I'm getting something similar with .NET Core 2.1 when trying to run unit tests but changing the project force x64 doesn't seem to work. See stack trace below.

I'm using "dotnet test" to run this.

Environment

C:\BuildAgent\work\50915b32e326b397\Testing\DragnetTech.EmailParsing.Tests>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.1.101 [C:\Program Files\dotnet\sdk]
  2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Here is the stack trace.

 Test method DragnetTech.EmailParsing.Tests.EmailProcessingTests.MineEmail_GoToMeeting3 threw exception:
System.InvalidOperationException: Splitter/consolidator worker encountered exception while consuming source data ---> System.DllNotFoundException: Unable to load DLL 'CpuMathNative' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Stack Trace:
    at Microsoft.ML.Runtime.Internal.CpuMath.Thunk.SumSqU(Single* ps, Int32 c)
   at Microsoft.ML.Runtime.Data.LpNormNormalizerTransform.<>c__DisplayClass27_0.<GetGetterCore>b__5(VBuffer`1& dst)
   at Microsoft.ML.Runtime.Data.ConcatTransform.<>c__DisplayClass36_0`1.<MakeGetter>b__0(VBuffer`1& dst)
   at Microsoft.ML.Runtime.Data.SchemaBindablePredictorWrapperBase.<>c__DisplayClass16_0`2.<GetValueGetter>b__0(TDst& dst)
   at Microsoft.ML.Runtime.Data.DataViewUtils.Splitter.Consolidator.<>c__DisplayClass4_1.<ConsolidateCore>b__2()
--- End of inner exception stack trace ---
    at Microsoft.ML.Runtime.Data.DataViewUtils.Splitter.Batch.SetAll(OutPipe[] pipes)
   at Microsoft.ML.Runtime.Data.DataViewUtils.Splitter.Cursor.MoveNextCore()
   at Microsoft.ML.Runtime.Data.RootCursorBase.MoveNext()
   at Microsoft.ML.Runtime.Api.PipeEngine`1.RunPipe(Boolean reuseRowObject)+MoveNext()
   at Microsoft.ML.PredictionModel`2.Predict(TInput input)
   at DragnetTech.EmailParsing.ML.Predictors.PredictLanguageName(String text) in C:\BuildAgent\work\50915b32e326b397\Functions\DragnetTech.EmailParsing\ML\Predictors.cs:line 45
   at DragnetTech.EmailParsing.EmailParser.<>c__DisplayClass2_3.<ProcessEmailBodySections>b__9(ILanguage l) in C:\BuildAgent\work\50915b32e326b397\Functions\DragnetTech.EmailParsing\EmailParser.cs:line 233
PaulDMendoza commented 6 years ago

Actually, this issue/comment resolved my problem. Had to install the Visual Studio C++ update.

https://github.com/dotnet/machinelearning/issues/605#issuecomment-408947401

Ivanidzo4ka commented 5 years ago

DRI RESPONSE: This issue looks like answered. I'm planning to close it within few days, if no one object to that.

Finansnet commented 5 years ago

In my case problem was on some particular machines. The same application was working fine on development ones, but did not work on production environment. Problem was solved by installing Visual C++ Redistributable 2017 on production server.

Marek

samcode22 commented 4 years ago

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)

Trying to implement sentimental analysis on comments in ASP.NET MVC Web Application(.NET Framework) although it is seen in solution explorer..and have kept solution platform as AnyCPU.Also tried x86 and x64 but no change. The error is pointing at this line: ModelOutput result = predEngine.Predict(input);

ArnieBerg commented 4 years ago

See https://github.com/dotnet/machinelearning/issues/4870.