Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build script and/or instructions to check for libomp on OS X #1282

Closed
justinormont opened this issue Oct 17, 2018 · 6 comments
Closed
Labels
Build Build related issue need info This issue needs more info before triage P0 Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.

Comments

@justinormont
Copy link
Contributor

System information

  • OS version/distro: OS X 10.12.6

Issue

LightGBM fails to run on OS X unless libomp is installed.

A change 6 days ago added the requirement for libomp and we haven't updated the build instructions or build script.

Error:

Unexpected exception: Unable to load shared library 'lib_lightgbm' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblib_lightgbm, 1): image not found, 'System.DllNotFoundException'
   at Microsoft.ML.Runtime.LightGBM.WrappedLightGbmInterface.DatasetCreateFromSampledColumn(IntPtr sampleValuePerColumn, IntPtr sampleIndicesPerColumn, Int32 numCol, Int32[] sampleNonZeroCntPerColumn, Int32 numSampleRow, Int32 numTotalRow, String parameters, IntPtr& ret)
   at Microsoft.ML.Runtime.LightGBM.Dataset..ctor(Double[][] sampleValuePerColumn, Int32[][] sampleIndicesPerColumn, Int32 numCol, Int32[] sampleNonZeroCntPerColumn, Int32 numSampleRow, Int32 numTotalRow, String param, Single[] labels, Single[] weights, Int32[] groups) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.LightGBM/WrappedLightGbmDataset.cs:line 45
   at Microsoft.ML.Runtime.LightGBM.LightGbmTrainerBase`3.CreateDatasetFromSamplingData(IChannel ch, Factory factory, Int32 numRow, String param, Single[] labels, Single[] weights, Int32[] groups, CategoricalMetaData catMetaData, Dataset& dataset) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs:line 660
   at Microsoft.ML.Runtime.LightGBM.LightGbmTrainerBase`3.LoadTrainingData(IChannel ch, RoleMappedData trainData, CategoricalMetaData& catMetaData) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs:line 343
   at Microsoft.ML.Runtime.LightGBM.LightGbmTrainerBase`3.TrainModelCore(TrainContext context) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs:line 103
   at Microsoft.ML.Runtime.Training.TrainerEstimatorBase`2.Microsoft.ML.Runtime.ITrainer.Train(TrainContext context) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.Data/Training/TrainerEstimatorBase.cs:line 155
   at Microsoft.ML.Runtime.Data.TrainUtils.TrainCore(IHostEnvironment env, IChannel ch, RoleMappedData data, ITrainer trainer, RoleMappedData validData, ICalibratorTrainer calibrator, Int32 maxCalibrationExamples, Nullable`1 cacheData, IPredictor inputPredictor) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.Data/Commands/TrainCommand.cs:line 259
   at Microsoft.ML.Runtime.Data.CrossValidationCommand.FoldHelper.RunFold(Int32 fold) in /Users/justinormont/Documents/Microsoft/src/machinelearning/src/Microsoft.ML.Data/Commands/CrossValidationCommand.cs:line 551
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

Temporary solution (fix it once for the current user)

On OS X, we can install libomp:

$ brew install libomp 

Longer term solutions (fix it again for all future users)

  • Update our build instructions to tell the user to run brew install libomp
  • Update our build script to check for libomp and fail the build if missing
  • (maybe) Automatically install libomp if missing--installing global system software during a build is bad though; is there a way to do a local install?
  • Add runtime check for libomp and produce a helpful error--this issue affects nuget users ; perhaps a change to the upstream LightGBM (@guolinke, thoughts?)

We should check if the libomp requirement increases the difficultly to distribute apps which call into ML.NET. Do the end-users (or the apps install script) have to install libomp?

Thanks to @eerhardt for finding the brew install libomp solution and providing much of the above background information.

@justinormont justinormont added Build Build related issue documentation Related to documentation of ML.NET labels Oct 17, 2018
@eerhardt
Copy link
Member

My opinion is that we should do all of the following steps (sorted in easy-to-hard order):

  1. Update our build instructions to tell the user to run brew install libomp
  2. Add runtime check for libomp and produce a helpful error--this issue affects nuget users
  3. Make LightGBM "standalone" deployable, and not depend on having libomp installed globally on the machine.
    • This would involve shipping libomp along with either LightGBM proper, or shipping it with our Microsoft.ML.LightGBM wrapper NuGet package.

Doing (2) above would help even when running the tests or trying to use LightGBM as a user. If we had a good error message that said You're trying to use LightGBM, but it couldn't be loaded. Do you have the all dependencies installed? See aka.ms/mlnetLightGBM.

I wouldn't update the build script to install global software on the machine. I think mutating machine state in that way is surprising to developers. Pulling down local copies of software into the repo is different than installing something into the equivalent of "Program Files". You also may need to run the build as sudo, which is not a great expectation.

Update our build script to check for libomp and fail the build if missing

I would vote against this because there are users who just want to build the repo, and use other bits that aren't LightGBM. Forcing them to install software that they aren't going to use isn't a great experience IMO.

@justinormont
Copy link
Contributor Author

I would recommend an error message (and related test) which gets the user to the solution faster. Perhaps, Error: LightGBM requires libomp which can be installed by running 'brew install libomp'. Sending them to a "have you checked the requirements" page sounds, to me, slightly passive aggressive and I think we could provide a directly actionable message.

This extra user-orientated convince has trade-offs, for instance we have to specifically check for libopm to know that's the issue (and not a simpler to detect 'LightGBM failed to load' error), and we have to alter the output text depending on platform. One upside is not having to maintain another aka.ms link.

For the build script error: Generally when I build software, I expect all parts which I build to work. If they build LightGBM I think they also expect it to be usable.

@Zruty0
Copy link
Contributor

Zruty0 commented Oct 29, 2018

@justinormont , is this about documentation update? Is this fixed already?

@Zruty0 Zruty0 added the need info This issue needs more info before triage label Oct 29, 2018
@justinormont
Copy link
Contributor Author

@Zruty0: This is still an open issue. @eerhardt and I have some recommendations/proposals above for methods to fix.

@PeterPann23
Copy link

HI,

I have deployed the application using dot net core 3.0 "Self Contained" profile on a new windows 2019 sever and have the same error. It's not limited to IOS.

@shmoradims shmoradims added P0 Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away. and removed documentation Related to documentation of ML.NET labels May 21, 2019
@codemzs
Copy link
Member

codemzs commented May 22, 2019

The build script does install libiomp 7.0 as evident from here , however we need to updated documentation for people using nugets that depend on mkl which depends on libiomp that they need libiomp v7.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Build Build related issue need info This issue needs more info before triage P0 Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.
Projects
None yet
Development

No branches or pull requests

6 participants