microsoft / microsoft/onnxruntime
Using ML.Net and ONNX in Alpine Docker gives library load error.
Open
Nobody has claimed this yet.
contributions welcome
feature request
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 179
Description
Describe the bug
I'm using ML.Net and ONNX to process object detection with a Yolo onnx model. It works fine on my M1 Macbook pro. But when I deploy it to linux, I get this error:
The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'onnxruntime' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library libonnxruntime: No such file or directory
at Microsoft.ML.OnnxRuntime.NativeMethods.OrtGetApiBase()
at Microsoft.ML.OnnxRuntime.NativeMethods..cctor() in Microsoft.ML.OnnxRuntime.dll:token 0x600006e+0x1
--- End of inner exception stack trace ---
at Microsoft.ML.OnnxRuntime.SessionOptions..ctor() in Microsoft.ML.OnnxRuntime.dll:token 0x60000f3+0x6f
at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath) in Microsoft.ML.OnnxRuntime.dll:token 0x6000021+0x2c
at Yolov5Net.Scorer.YoloScorer`1..ctor() in Damselfly.ML.ObjectDetection.dll:token 0x6000020+0x34
at Damselfly.ML.ObjectDetection.ObjectDetector..ctor() in Damselfly.ML.ObjectDetection.dll:token 0x6000001+0x15
I've updated the Dockerfile to install libgomp as I've seen recommended around the place (e.g., here) but it doesn't seem to work. I'm not sure if this is something Alpine-related.
My Dockerfile is here.
Urgency
Hard deadlines: none
System information
- Linux version: Synology linux v3.10.105, running Docker
- ONNX Runtime installed from (source or binary): binary
- ONNX Runtime version: Not sure
- Python version: N/A
- CLR Version: 6.0 preview 5
- ML.Net version: 1.8.0
- Visual Studio version (if applicable): VS for Mac v8.10
- GCC/Compiler version (if compiling from source): N/A
- CUDA/cuDNN version: N/A
- GPU model and memory: N/A
- ONNX Model: Yolov5
Expected behavior
No library exception, and the Inference initialises correctly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.