machinelearning icon indicating copy to clipboard operation
machinelearning copied to clipboard

Unable to load shared library 'MklImports' or one of its dependencies.

Open mphollas opened this issue 7 years ago • 49 comments

System information

  • Mac 0S Mojave 10.14.3:
  • dotnet --version 2.2.300
  • Project references
  • Microsoft.ML
  • Microsoft.ML.Mkl.Redis
  • Microsoft.ML.TimeSeries

Issue

  • Possible that this is of the same origin as #3694 but in case it is a separate case I have posted this issue.

  • What did you do? Followed new forecasting tutorial for ML.Net 1.1 https://github.com/dotnet/machinelearning/blob/master/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/Forecasting.cs

  • What happened? Dll not found exception

  • What did you expect? Program to run successfully

Source code / logs

Unable to load shared library 'MklImports' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libMklImports, 1): image not found

at Microsoft.ML.Transforms.TimeSeries.EigenUtils.Dsytrd(Layout matrixLayout, Uplo uplo, Int32 n, Double[] a, Int32 lda, Double[] d, Double[] e, Double[] tau)\n at Microsoft.ML.Transforms.TimeSeries.EigenUtils.MklSymmetricEigenDecomposition(Single[] input, Int32 size, Single[]& eigenValues, Single[]& eigenVectors)\n at Microsoft.ML.Transforms.TimeSeries.TrajectoryMatrix.ComputeSvd(Single[]& singularValues, Single[]& leftSingularvectors)\n at Microsoft.ML.Transforms.TimeSeries.AdaptiveSingularSpectrumSequenceModeler.AdaptiveSingularSpectrumSequenceModelerInternal.TrainCore(Single[] dataArray, Int32 originalSeriesLength)\n at Microsoft.ML.Transforms.TimeSeries.AdaptiveSingularSpectrumSequenceModeler.AdaptiveSingularSpectrumSequenceModelerInternal.Train(RoleMappedData data)\n

mphollas avatar Jun 23 '19 10:06 mphollas

I got a similar error running an ASP.NET core 2.2 app on a linux64 docker container

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1] An unhandled exception has occurred while executing the request. System.DllNotFoundException: Unable to load shared library 'MklImports' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libMklImports: cannot open shared object file: No such file or directory at Microsoft.ML.Transforms.TimeSeries.EigenUtils.Dsytrd(Layout matrixLayout, Uplo uplo, Int32 n, Double[] a, Int32 lda, Double[] d, Double[] e, Double[] tau) at Microsoft.ML.Transforms.TimeSeries.EigenUtils.MklSymmetricEigenDecomposition(Single[] input, Int32 size, Single[]& eigenValues, Single[]& eigenVectors) at Microsoft.ML.Transforms.TimeSeries.TrajectoryMatrix.ComputeSvd(Single[]& singularValues, Single[]& leftSingularvectors) ….

ilias avatar Jul 14 '19 21:07 ilias

Hi!

I run into the same exact situation with a .Net Core 2.2 app (console) here using Ubuntu 16.04 x64: Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial

dotnet --version 2.2.300

I get exactly the same exception as described above.

flo8 avatar Jul 15 '19 12:07 flo8

Same issue in here. mlnet 0.14.27903.10

.NET Core SDK (reflecting any global.json): Version: 2.2.401 Commit: 729b316c13

Runtime Environment: OS Name: Mac OS X OS Version: 10.14 OS Platform: Darwin RID: osx.10.14-x64 Base Path: /usr/local/share/dotnet/sdk/2.2.401/

Host (useful for support): Version: 2.2.6 Commit: 7dac9b1b51

.NET Core SDKs installed: 2.2.301 [/usr/local/share/dotnet/sdk] 2.2.401 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

eduardobr avatar Jul 25 '19 21:07 eduardobr

Same issue here

OS Name: Mac OS X OS Version: 10.14.1 Platform: Darwin

dotnet --version 2.2.300

Benzidrine avatar Jul 29 '19 06:07 Benzidrine

@codemzs, any comment?

wschin avatar Aug 11 '19 05:08 wschin

I have the same issue, but on Windows and 4.6 .Net framework.

OS: Windows 10

.NET Framework 4.6.1

Trying to use Anomaly Detection, only Iid works, SSA and SRCNN do not. On the same machine, if running on .Net Core 2.2 everything works well

archeg avatar Aug 20 '19 11:08 archeg

Hi @wschin @codemzs !

Is there anything we can do to help you guys move this forward?

Many thanks,

flo8 avatar Aug 23 '19 15:08 flo8

Having same issue on Ubuntu 19.04 with AnomalyDetection_PowerMeterReadings.

dotnet --version 2.2.401

mlnet 0.15.28007.4

dhunt84971 avatar Sep 06 '19 17:09 dhunt84971

Hi @codemzs @wschin !

How can we help you troubleshoot this?

Cheers

flo8 avatar Sep 11 '19 12:09 flo8

Hi! I have the same issue.

Runtime Environment: RID: ubuntu.18.04-x64 Base Path: /usr/share/dotnet/sdk/2.2.401/

I tried the sample "DetectChangePointBySsaStream.cs" for ML 1.2.0, 1.3.1 and 1.4.0-preview

Thanks

lessenko avatar Oct 03 '19 06:10 lessenko

Had the precise error described here when using TimeSeries in ML.net and what fixed it for me was installing the Intel MKL: https://software.intel.com/en-us/mkl

In my case specifically, I was working with dotnet via the .NET Core SDK Docker images: https://hub.docker.com/_/microsoft-dotnet-core-sdk/

Within docker (debian base), the fix for me was:

RUN \
  sed -i 's/ main/ main contrib non-free/' /etc/apt/sources.list && \
  apt-get update && \
  DEBIAN_FRONTEND=noninteractive apt-get install -y intel-mkl

I presume similar installs of Intel MKL on non-debian linux or macos are also likely to fix the issue

rpln avatar Oct 03 '19 17:10 rpln

Hi @rpln and thanks for sharing this info!

I also tried it here on our systems but still have the problem. Is there a way to make sure that MKL is correctly installed?

I also didn't find any mention of how to install this dependency on ML.Net website. Trying to Google it didn't give much results as well. @codemzs any idea on this?

Many thanks,

flo8 avatar Oct 07 '19 09:10 flo8

Hi all!

Thanks a lot @rpln, after checking this link on SO it seemed that MKL was not correctly installed in our Docker container even if we followed the instructions above. After following this and this, it now seems to work correctly.

It's however a bit sad to see that this MKL thing is currently nowhere to be found on ML.Net documentation and that this ticket has been opened for almost 4 months :(

Thanks a lot to @rpln for your contribution!

Flo

flo8 avatar Oct 08 '19 08:10 flo8

Hi all!

Thanks a lot @rpln and @flow8 my sample works. My decision is to put library libiomp5.so from intel-mkl 2019.0.117 into local nuget directory for microsoft.ml.mkl.redist. Docker is not used.

Regards.

lessenko avatar Oct 09 '19 07:10 lessenko

I can't get this working on Mac.

I tried installing MKL from https://software.seek.intel.com/performance-libraries

But it's still failing.

AceHack avatar Oct 09 '19 20:10 AceHack

I've tried following the instructions here too, no luck https://github.com/firemodels/fds/wiki/Linking-to-Intel-Math-Kernel-Libraries-in-Linux-and-OSX https://github.com/firemodels/fds/wiki/Compiling-FDS-with-GNU-Fortran-in-Mac-OSX

AceHack avatar Oct 09 '19 21:10 AceHack

Hi AceHack! Just in case, libiomp5 has needed definitions for libMklImports (Nuget). It's for Ubuntu. For Mac I suppose it's analog libMklImports.dylib and libiomp5.dylib https://software.intel.com/en-us/articles/dyld-library-not-loadedlibiomp5dylib

Nuget local dir for Mac ---.nuget/packages/microsoft.ml.mkl.redist/1.3.1/runtimes/osx-x64/native/


lessenko avatar Oct 10 '19 06:10 lessenko

I am running the mlnet global tool, microsoft.ml.mkl.redist is not present in my nuget cache.

AceHack avatar Oct 10 '19 11:10 AceHack

Just in case, I use Mono, MonoDevelop and Nuget (in MonoDevelop).

lessenko avatar Oct 10 '19 13:10 lessenko

Via NuGet I add only Microsoft.ML.TimeSeries package. Microsoft.ML.Mkl.Redist is added itself.

lessenko avatar Oct 10 '19 14:10 lessenko