dotnet / machinelearning

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

Unable to load DLL 'CpuMathNative': The specified module could not be found. #6623

Closed ConfieBlake closed 9 months ago

ConfieBlake commented 1 year ago

System Information (please complete the following information):

Describe the bug I added a ML model to a Class Library which targets at NET Framework 4.8.1. I could build the dll and run it in vscode notebook. This library is configured to debug on x64. But when I deployed the library on cosmos and run the SCOPE jobs with it, it starts to give the error "Unable to load DLL 'CpuMathNative': The specified module could not be found." image image

I could not use NET Core, because NET Core needs to load System.Runtime version 6.0.0, which is incompatible with my project.

And below is my project: ProductNameClassifier.zip

Screenshots, Code, Sample Projects image

LittleLittleCloud commented 1 year ago

CpuMathNative is located in runtime folder, try adding hint path like this

<Reference Include="CpuMathNative.dll">
   <HintPath>..\packages\microsoft.ml.cpumath\2.0.1\runtimes\win-x64\nativeassets\netstandard2.0\CpuMathNative.dll</HintPath>
</Reference>
michaelgsharp commented 9 months ago

I am not super familiar with Scope, but when using scope you need to upload the native binaries in a specific way. Closing this issue since its related to scope deployment and not ml.net.