TensorFlow.NET: DLL Not Found Exception
Hi.
I’ve created a new project in Windows 10 VS 2019 targeting .NET Framework 4.6.2.
Then, I’ve installed the Tensorflow.NET Nuget Package version 0.8.0.
In Program class, I’ve inserted using Tensorflow;
.
In Main method, I’ve inserted the code var a = tf.constant(3);
.
When I run the code, I receive the exception: DllNotFoundException: Unable to load DLL 'tensorflow': The specified module could not be found.
.
I’ve found the closed issue #144 (Cannot load Tensorflow DLL error), but I was not able to solve the problem after reading it.
There is a TensorFlow.NET.dll
file in ..\bin\Debug
folder, but there is no TensorFlow.dll
file in that folder.
I’ve found a TensorFlow.dll
file in ..\packages\TensorFlow.NET.0.8.0\tensorflowlib\runtimes\win-x64
folder.
I’ve tried to copy this file to the ..\bin\Debug
folder, but the error persisted.
I’ve tried the same with VS 2017 and received the same exception.
Could you help me?
Thanks in advance.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (6 by maintainers)
Bingo!
Its working now!
For those who are facing the same difficulty, just follow these steps:
Any CPU
dropdown and select the optionConfiguration Manager
:Active solution platform
label, select the option<New...>
:OK
button:x64
will be selected in the top menu:As Haiping has shown above, the application is working fine:
Thank you very much @Oceania2018, @kerryjiang and @tradexdev, for the great help!
That almost worked for me. Added
using static Tensorflow.Binding;
and then it worked.@eduardobellotto Try to install another redist provided by Microsoft https://www.nuget.org/packages/Microsoft.ML.TensorFlow.Redist
I had same issues but every time I solved one with advices from this thread, I was getting other errors which went deeper and deeper into the system until it had already nothing to do with TensorFlow anymore. What helped me is to create completely new project ad install a bit older versions of NuGet packages (I used Microsoft.ML 1.6, Microsoft.ML.ImageAnalytics 1.6, Microsoft.ML.Visions 1.6 and SciSharp.TensorFlow.Redist 2.3.1.
These are versions of packages which VS 2022 ML Model Builder uses, and there everything works ok
@eduardobellotto Just make sure you’re running x64 platform.