TensorFlowSharp icon indicating copy to clipboard operation
TensorFlowSharp copied to clipboard

Build fails to copy all required linux shared objects for TensorFlow version 1.15.

Open craigwalton opened this issue 5 years ago • 3 comments

Describe the bug Build fails to copy all required linux shared objects for TensorFlow version 1.15, TensorFlowSharp version 1.15.1.

To Reproduce Run using TensorFlowSharp 1.15.1 NuGet packages on linux.

Expected behavior Required dependencies to be available.

Exception Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'libtensorflow' or one of its dependencies.

Desktop (please complete the following information): Debian GNU/Linux 9 (stretch) within Docker container.

Additional context Only libtensorflow.so and libtensorflow_framework.so are copied from libtensorflow\lib to runtimes\linux\native\ as part of the build specified in TensorFlowSharp.csproj. The following additional libraries from libtensorflow are also required for running TensorFlow 1.15 on linux:

libtensorflow.so.1
libtensorflow.so.1.15.0
libtensorflow_framework.so.1
libtensorflow_framework.so.1.15.0

I suspect the same issue exists for the .dylib files required by OS X, though have not tested this myself.

I propose replacing the following lines in TensorFlowSharp.csproj:

<None Include="..\native\libtensorflow.so" Link="nuget\runtimes\linux\native\libtensorflow.so" PackagePath="runtimes\linux\native\libtensorflow.so" Pack="true" />
<None Include="..\native\libtensorflow_framework.so" Link="nuget\runtimes\linux\native\libtensorflow_framework.so" PackagePath="runtimes\linux\native\libtensorflow_framework.so" Pack="true" />

With the following:

<None Include="..\native\libtensorflow*.so*">
  <Link>nuget\runtimes\linux\native\%(Filename)%(Extension)</Link>
  <PackagePath>runtimes\linux\native\%(Filename)%(Extension)</PackagePath>
  <Pack>True</Pack>
</None>

Libtensorflow binaries https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.15.0.tar.gz https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.15.0.zip

Please let me know if you'd like me to create a pull request to resolve this issue.

craigwalton avatar Feb 03 '20 15:02 craigwalton

Hi @craigwalton,

I'm facing the same issue as you. In the meantime, I've created my own NuGet which is working. But it is not productized. It seems this project is not maintained anymore. How did you overcome the issue on your side ? Did you fork the project ? Did you create a new NuGet as well ? If yes, did you publish it in public repo ?

Thanks.

nateagr avatar Mar 17 '20 12:03 nateagr

Hi @nateagr,

I am using TensorFlowSharp within a Docker container. So I added a RUN instruction to the Dockerfile which downloads (https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz) and unpacks the missing libraries into the required directory. I did not fork the project or publish anything on NuGet.

Sorry - this probably is not much help to you.

craigwalton avatar Mar 17 '20 13:03 craigwalton

Thanks for your answer 👍

nateagr avatar Mar 17 '20 14:03 nateagr