tensorflow: Tensorflow.loadLibrary() not working on Windows

Running:

TensorFlow.loadLibrary("ner-dl/win/_lstm_ops.so")

Returns:

java.lang.UnsatisfiedLinkError: ner-dl\win\_lstm_ops.so not found
	at org.tensorflow.TensorFlow.loadLibrary(TensorFlow.java:47)

We’re trying to load contrib .so files dynamically from java API. These .so files are generated on Windows by installing tensorflow through pip. Using python 3.6.8 to do so and retrieving them from the library source code. These libraries are from tensorflow.contrib, since this is what we’re using on our graphs. To me, this sounds like a path resolving issue, since it’s the same error than making up an invented path.

Works fine when using appropriate .so files on Linux and Mac.

Same happens if using absolute paths btw:

java.lang.UnsatisfiedLinkError: C:\Users\saifa\IdeaProjects\spark-nlp\src\main\resources\ner-dl\win\_lstm_ops.so not found
	at org.tensorflow.TensorFlow.loadLibrary(TensorFlow.java:47)

It seems this also happened to this poor guy here: https://stackoverflow.com/questions/50115117/using-ops-from-tensorflow-contrb-on-windows-via-java-api

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): TensorFlow.loadLibrary("ner-dl/win/_lstm_ops.so")
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): Binary from pip
  • TensorFlow version (use command below): b'v1.12.0-rc2-3-ga6d8ffae09' 1.12.0
  • Python version: Using Java API
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

Describe the current behavior Running TensorFlow.loadLibrary("ner-dl/win/_lstm_ops.so") returns

java.lang.UnsatisfiedLinkError: ner-dl\win\_lstm_ops.so not found
	at org.tensorflow.TensorFlow.loadLibrary(TensorFlow.java:47)

Describe the expected behavior Should be able to load libraries dynamically on Windows. This works fine from Linux and Mac.

Code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. TensorFlow.loadLibrary("ner-dl/win/_lstm_ops.so")

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Will take a look, sorry for the delay.

I confirm this can be closed. Thanks

@saif-ellafi Please confirm if we may moved this to closed status.