You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the application the following exception is thrown on line 70 of Program.cs
I have located the missing DLL in the packages folder. If I manually copy the file into the output folder of my project the application runs as expected.
============== Exception Information ==============
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.ML.Runtime.EntryPoints.EntryPointNode.Run()
at Microsoft.ML.Runtime.EntryPoints.EntryPointGraph.RunNode(EntryPointNode node)
at Microsoft.ML.Runtime.EntryPoints.JsonUtils.GraphRunner.RunAllNonMacros()
at Microsoft.ML.Runtime.EntryPoints.JsonUtils.GraphRunner.RunAll()
at Microsoft.ML.LearningPipeline.TrainTInput,TOutput
at myApp.Program.Main(String[] args) in C:\Users\Dave\Documents\Visual Studio 2017\Projects\MLTests\Iris\Program.cs:line 70
Inner Exception 1:
TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception 2:
DllNotFoundException: Unable to load DLL 'CpuMathNative': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I can confirm this issue. Besides the mentioned workaround (manually copying the missing file) it also works to switch the "TargetFramework" property from "net47" to "netcoreapp2.0". Therefore it seems to be related with using .NET Framework.
On .NET Framework, if you are targeting Any CPU. ML.NET only supports x64, so if you are using the desktop/full .NET Framework, ensure you change Any CPU to x64, since there are only x64 native assemblies.
@aklcraigc I manually changed the .csproj file by adding the line <PackageReference Include="Microsoft.ML" Version="0.1.0" />
And then changed the targeting to x64
@markusweimer Sorry for the lack of updates. The suggestions solved that error but there was a minor issue with the solutiion, I'm not sure whether this was because I didn't start from scratch and still had things in my packages folder. Below are the steps I took.
I removed the packages added via NuGet from the solution.
Switched VS Tools->Options to use 'PackageReference' for package management.
I then re-added Microsoft.ML from NuGet.
There was one minor issue, it did not add any of the dependancies it had during the initial attempt. I ended up having to manual add the json package to get the app to run. As I said at the top I'm not sure if this was because I didn't start totally from scratch.
You can close this issue for me but if you are not going to or can't fix the package.config issue perhaps adding something to the getting started page would be an idea.
I just tried the aforementioned"PackageReference" workaround but I still getting the error. I had to switch to net462 which I assume is the source of the issue.
@claudiobottari - the issue is that ML.NET only supports x64, and you are attempting to use AnyCPU. You can change the following:
<RuntimeIdentifier>AnyCPU</RuntimeIdentifier>
||
V <RuntimeIdentifier>win-x64</RuntimeIdentifier>
And remove the line
<PlatformTarget>AnyCPU</PlatformTarget>
That should fix your project. When fixing #93, I am also adding a build error message to help people in this situation know that they need to target x64.
My issue seems to be solved too. I already used "PackageReference" and x64. But I was setting x64 as PlatformTarget. Tried it with RuntimeIdentifier and finally the CpuMathNative.dll exists in the output folder of my project. Everything seems to work now.
I have retested by setting up a new project and then adding Microsoft.ML using NuGet using Visual Studio set to manage packages via PackageReference. There were no errors.
Activity
pareion commentedon May 13, 2018
I followed some of the suggetions from this page and got it to work with that tutorial
#93
aklcraigc commentedon May 14, 2018
@pareion I'm getting the same problem, what specifically do you think fixed the problem.
tobiasw2 commentedon May 14, 2018
I can confirm this issue. Besides the mentioned workaround (manually copying the missing file) it also works to switch the "TargetFramework" property from "net47" to "netcoreapp2.0". Therefore it seems to be related with using .NET Framework.
eerhardt commentedon May 14, 2018
I've seen 2 cases where this error happens:
<PackageReference>in your .csproj. This issue is tracked by Microsoft.ML NuGet package doesn't work with packages.config #93, and a fix should be made soon to the daily builds.Any CPU. ML.NET only supports x64, so if you are using the desktop/full .NET Framework, ensure you changeAny CPUtox64, since there are only x64 native assemblies.pareion commentedon May 15, 2018
@aklcraigc I manually changed the .csproj file by adding the line
<PackageReference Include="Microsoft.ML" Version="0.1.0" />And then changed the targeting to x64
aklcraigc commentedon May 15, 2018
@pareion Thanks, that did the trick.
markusweimer commentedon May 16, 2018
@DaisyDave, did the suggestions in this issue work for you? If so, we can close the issue :)
katterfelto commentedon May 16, 2018
@markusweimer Sorry for the lack of updates. The suggestions solved that error but there was a minor issue with the solutiion, I'm not sure whether this was because I didn't start from scratch and still had things in my packages folder. Below are the steps I took.
There was one minor issue, it did not add any of the dependancies it had during the initial attempt. I ended up having to manual add the json package to get the app to run. As I said at the top I'm not sure if this was because I didn't start totally from scratch.
You can close this issue for me but if you are not going to or can't fix the package.config issue perhaps adding something to the getting started page would be an idea.
claudiobottari commentedon May 16, 2018
I just tried the aforementioned"PackageReference" workaround but I still getting the error. I had to switch to net462 which I assume is the source of the issue.
eerhardt commentedon May 16, 2018
@claudiobottari - are you using VS 2015 or VS 2017? Would it be possible to share your .csproj so I can take a look?
claudiobottari commentedon May 16, 2018
VS 2017
csproj attached
Sample.zip
eerhardt commentedon May 16, 2018
@claudiobottari - the issue is that ML.NET only supports x64, and you are attempting to use
AnyCPU. You can change the following:<RuntimeIdentifier>AnyCPU</RuntimeIdentifier>||
V
<RuntimeIdentifier>win-x64</RuntimeIdentifier>And remove the line
<PlatformTarget>AnyCPU</PlatformTarget>That should fix your project. When fixing #93, I am also adding a build error message to help people in this situation know that they need to target x64.
claudiobottari commentedon May 16, 2018
Thank you, my project works now
tobiasw2 commentedon May 16, 2018
My issue seems to be solved too. I already used "PackageReference" and x64. But I was setting x64 as PlatformTarget. Tried it with RuntimeIdentifier and finally the CpuMathNative.dll exists in the output folder of my project. Everything seems to work now.
katterfelto commentedon May 16, 2018
I have retested by setting up a new project and then adding Microsoft.ML using NuGet using Visual Studio set to manage packages via PackageReference. There were no errors.
katterfelto commentedon May 16, 2018
I'm going to close my issue.
Dineshkumar-Ponnusamy commentedon May 29, 2018
Adding,
<PackageReference Include="Microsoft.ML" Version="0.1.0" />inside the<ItemGroup>of *.csproj worked for me.added correct validation check (dotnet#137)
code migration from machinelearning-automl to machinelearning repo fe…
added correct validation check (dotnet#137)
Added onnx export functionality for LpNormNormalizingTransformer (#4161)
Added Onnx export functionality to PCATransformer (#4188)
pjmelvin commentedon Dec 23, 2019
I had to copy the file from the reference location in the ML download to the bin directory after the build to get this to work... bother.