ML.NET 1.5.5 -> Microsoft.ML.Mkl.Redist : Unable to load DLL 'MklImports': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Paul 96 Reputation points
2021-04-10T10:52:29.797+00:00

Windows .NETFramework 4.7.2
ML.NET packages 1.5.5 (I have tried a lower version too).

When calling Context.Forecasting.ForecastBySsa

"Unable to load DLL 'MklImports': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

The 1.5.5 version of Microsoft.ML.MKl.Redist is installed and the Microsoft.ML.Mkl.Redist.dll is present i.e. "Copy Local" has found it and copied it to the output directory.

I've seen issues around this for .NET core from 2019 / 2020 but how can I proceed to get this working in a .NETFramework environment ?

86492-image.png

<packages>
<package id="Microsoft.ML" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.CpuMath" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.DataView" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.Mkl.Redist" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.TimeSeries" version="1.5.5" targetFramework="net472" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net472" />
<package id="System.Buffers" version="4.4.0" targetFramework="net472" />
<package id="System.CodeDom" version="4.4.0" targetFramework="net472" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net472" />
<package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Channels" version="4.7.1" targetFramework="net472" />
<package id="System.Threading.Tasks.Dataflow" version="4.8.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,827 questions
.NET Machine learning
.NET Machine learning
.NET: Microsoft Technologies based on the .NET software framework.Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.
150 questions
0 comments No comments
{count} votes

Accepted answer
  1. Paul 96 Reputation points
    2021-04-13T09:52:32.257+00:00

    The issue here appears to be with my compiler tools - I do not use Microsoft C#, but RemObjects Oxygene.

    If I build a simple example using standard Microsoft C# in .NetFramework , I get several DLL's copied to my bin/Debug directory that do not get copied in the equivalent Oxygene project. These are CpuMathNative.dll, LdaNative.dll, libiomp5md.dll, MklImports.dll and MklProxyNative.dll . The C# project works as expected and without issue.

    87382-image.png

    If I copy those same DLL's into the debug folder of my Oxygene project, it works as per the C# version.

    The issue therefore appears to be with the RemObjects tool chain. I will take the issue up with them.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,611 Reputation points
    2021-04-12T05:40:42.937+00:00

    Hi Paul-5516,
    This issue is usually caused by improperly installed libraries. Please make sure your Visual Studio installation has these packages installed correctly.
    Your DLL might depend on other DLLs to get its job done. If you didn't copy or install those too, you'd indeed get this error message.
    I have some suggestions you can refer to.

    1. Check to see if MklImports.dll is in your specific \bin folder.
    2. Check the compatibility of dll with 32bit or 64bit CPU.
    3. You can also try the solution in this thread.
      And there are more suggestions in this thread you can refer to.
      Best Regards,
      Daniel Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentationto enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Yurii Cherekh 1 Reputation point
    2021-04-19T06:53:32.72+00:00

    ML.NET support CUDA 11
    Loading model from: F:\V2Sorter\DataSet\03.01.2021\imageClassifier_2.zip
    2021-04-16 16:06:33.457209: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
    pciBusID: 0000:03:00.0 name: GeForce RTX 3080 computeCapability: 8.6
    coreClock: 1.905GHz coreCount: 68 deviceMemorySize: 10.00GiB deviceMemoryBandwidth: 707.88GiB/s
    2021-04-16 16:06:33.458465: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
    2021-04-16 16:06:33.459114: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
    2021-04-16 16:06:33.459639: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
    2021-04-16 16:06:33.460164: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
    2021-04-16 16:06:33.460705: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
    2021-04-16 16:06:33.461270: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
    2021-04-16 16:06:33.461946: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
    2021-04-16 16:06:33.462589: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
    2021-04-16 16:06:33.463409: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
    2021-04-16 16:06:33.464111: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
    2021-04-16 16:06:33.464830: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
    2021-04-16 16:06:33.465221: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
    2021-04-16 16:06:33.465788: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7745 MB memory) -> physical GPU (device: 0, name: GeForce RTX 3080, pci bus id: 0000:03:00.0, compute capability: 8.6)
    Exception thrown: 'System.EntryPointNotFoundException' in Microsoft.ML.Vision.dll
    device is disconnected
    Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
    Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
    The thread 0x2f80 has exited with code 0 (0x0).

    I'm using "SciSharp.TensorFlow.Redist-Windows-GPU" with CUDA 2.4.0 support but get the exception "Exception thrown: 'System.EntryPointNotFoundException' in Microsoft.ML.Vision.dll"
    what could be the problem?

    0 comments No comments

  3. Ed Santiago 1 Reputation point
    2022-04-16T12:12:08.797+00:00

    The cure for my issue was to compile the library that's using ML.net to target x86. Once you set the target and recompile the project, you should be good to go!

    Ed

    0 comments No comments