-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Unable to load shared library 'onnxruntime' on MacOS (DllNotFoundException) #9707
Comments
Use |
@leXorNet Try adding the Microsoft.ML.OnnxRuntime package, this solved it for me on Macos. |
@leXorNet the problem is that it doesn't work on mac OS in particular. |
I can confirm the error with a M1 Mac.
On the website it looks like arm is not (yet) supported for mac. |
@juwens I solved the problem. What i did was installing "Microsoft.ML.Mkl.Redist" package from nuget.org. I am not sure what the problem actually is about, but it finally works. What worked for me more: installing "Microsoft.ML.OnnxRuntime.MKLML" package(int this case without "Microsoft.ML.Mkl.Redist"). Issue still is mysterious. I think i would better not touch any packages regarding onnx so that i won't have any problems in the future. Thank you! |
@leXorNet I think the issue can be closed. |
@leXorNet thanks for the workaround. The packaging of the nuget needs to be fixed for osx anyways. the lib must be placed in respective for arm: If somebody is interested:
|
@juwens Exactly! |
@niyazidageek which cpu arch do you have? Intel x64 or Apple Silicon aka arm64? Please post the output of |
@juwens Mine is Apple Silicon aka arm64. Here is the information: |
thanks for the info. As i thought, you are using a x86 runtime as you can see in the output (because Net 5 has no arm runtime) despite having a ARM Mac. Install the Net 6 arm64 Runtime and you will see the problem again, even with the additional |
I was able to work around this issue on macOS by using homebrew to install the
It lets me run workloads, but I would expect the package to bring down the latest |
@khalidabuhakmeh Wow! Thank you for the solution!!! And also, installing previous version of onnxruntime helped me as well. I had 1.10.0, which was not working on Mac OS, however, 1.8.1 runs perfectly. Anyways, thank you! |
@niyazidageek I still think something is wrong with the NuGet package because the It's enough to get some code running at least. 😅 |
@leXorNet I think you can close the issue. Have those methods helped you? |
I wouldn't close this issue, the problem still exists in the NuGet package. There doesn't seem to be a build target for macOS environments, which is what is failing to copy the The issue is a missing build target for macOS outside of Xamarin targets. Update: Looking at the targets under the csharp directory, I noticed there is no mention of either macOS or Linux platforms under the That means this library is effectively broken for folks looking to use it in those environments. The targets need updating to support more platforms, as right now it is hardcoded with a Windows environment in mind. I'm not exactly sure how or what to do to fix it, but identifying it is half the problem, right? 😅 |
I believe the culprit is this line in To test this, users can manually copy the |
@baronfel thanks, I was also searching for this line, but without success. |
Brief update - my earlier comment is in fact actually wrong! The |
If you're having this issue today, can you run your application with the |
This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details. |
I'm running into this issue as well and while I get someone to get a core host trace file, the error messages include at least some of the paths being checked:
|
@silveredgold what ORT version are you using? |
.net 6 support was added in the most recent release - 1.12 - and net6.0-macos is included as a target framework. @silveredgold maybe create a new issue with full details of your setup such as ORT version, which nuget packages you're using, what framework/s you're targeting etc. |
I was using 1.12 with |
Note that it works only if you will pass it to executable directly, I had to add it to my Rider's executable configuration, adding it to OS environment variable, using It seems to me, as it is a dotnet runtime issue, as exception says that it tried searching specific paths, and they are probably somewhat hardcoded for macOS, and PATH environment variable not being respected. |
I'm having the same issue using macOS Ventura 13.0.1 with Intel cpu. I'm using Microsoft.ML.OnnxRuntime 1.13.1 in .Net 6 Console application. Edit: I downgraded this package to 1.12.1 and it works fine for me. |
I also encountered this problem and solved it with a workaround. Seems to be an issue with the local NuGet / project(?)
What did not work for me:
What did work for me (multiple times; very reproducible):
My system: |
Crash when trying to load onnxruntime when running console application on osx with .net6 core and macos workload. Dll's looks to be in the bin folder, but can't be found/loaded. No macos versions available in the nuget package?
Reproduction steps:
Create a new .netcore 6 console application.
Add macOS workload and set target framework to 'net6.0-macos'.
Add Microsoft.ML and OnnxRuntime from nuget.
Add some code to call .ApplyOnnxModel(...).
-> Crash
Setup:
macOS 11.6 (x64)
Visual Studio Mac 2022 (preview 1->3)
OnnxRuntime 1.9.0 (from nuget)
.NetCore 6.0 with macOS workload
Callstack:
The text was updated successfully, but these errors were encountered: