-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Java version upgrade from 1.13.1 to 1.14.0 got error #30635
Comments
Just to verify after upgrading to TF 1.14.0 are you able to import Tensorflow in Java successfully.Thanks! |
Yes, import is success, but it seems libtensorflow.so was not found in tmp directory. |
I can confirm that 1.14.0 does not load its library. I have tested it on Linux (Ubuntu 19.04) and OSX (current) on Java 1.8. I have put the code example into https://github.com/davidmweber/tf-java-error so that it can easily be replicated. Here is the stack trace (with org.tensorflow.NativeLibrary.DEBUG=1) org.tensorflow.NativeLibrary: tryLoadLibraryFailed: no tensorflow_jni in java.library.path |
same issue.
exception :
|
I experienced this on both Mac OS X and Linux. Tracing through the The same thing happens on Linux with .so files. The I worked around this on Mac OS X by writing code to extract all the flavors and load the libs before |
Can confirm this is an issue with 1.14.0 on OS X |
Also have this problem in OSX, but not in Windows. @silvanheller @klarson2 Here is a quick workaround:
to
@davidmweber I guess if it is the same error on linux you can also add
At least for me, this version overrides the one in the jar. Everything seems to work fine. |
Same for me in macOS An exception or error caused a run to abort: /private/var/folders/4p/vy_4h7z563d7gnq98nsg0gc80000gn/T/tensorflow_native_libraries-1566919860658-0/libtensorflow_jni.dylib: dlopen(/private/var/folders/4p/vy_4h7z563d7gnq98nsg0gc80000gn/T/tensorflow_native_libraries-1566919860658-0/libtensorflow_jni.dylib, 1): Library not loaded: @rpath/libtensorflow_framework.1.dylib
Referenced from: /private/var/folders/4p/vy_4h7z563d7gnq98nsg0gc80000gn/T/tensorflow_native_libraries-1566919860658-0/libtensorflow_jni.dylib
Reason: image not found
java.lang.UnsatisfiedLinkError: /private/var/folders/4p/vy_4h7z563d7gnq98nsg0gc80000gn/T/tensorflow_native_libraries-1566919860658-0/libtensorflow_jni.dylib: dlopen(/private/var/folders/4p/vy_4h7z563d7gnq98nsg0gc80000gn/T/tensorflow_native_libraries-1566919860658-0/libtensorflow_jni.dylib, 1): Library not loaded: @rpath/libtensorflow_framework.1.dylib
Referenced from: /private/var/folders/4p/vy_4h7z563d7gnq98nsg0gc80000gn/T/tensorflow_native_libraries-1566919860658-0/libtensorflow_jni.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:101)
at org.tensorflow.TensorFlow.init(TensorFlow.java:66)
at org.tensorflow.TensorFlow.<clinit>(TensorFlow.java:70) |
I'm experiencing the same issue with Ubuntu 16.04, Oracle JDK 1.8.0_201. |
If you use Scala with Gradle, in addition to provided workaround you'll also need to modify your
|
This copies the missing shared lib to a standard location. The fix is easier to deploy. Copied from #170 with 1 cleanup. I'll follow up with some tests which failed on TF 1.14
Any chance of getting this pushed to maven? |
The upcoming release of TF 1.15.0 will contain the fixes for this problem. |
Switching to 1.15.0 didn't help a lot. Having the same issue and the same error message (... Reason: image not found... ) on macOS 10.14.5. |
@mickaeltardy Are you sure? The reason I am asking is to be sure the cache is cleared and you are using only the |
Thank you for pointing out for me. Properly cleaning dependencies made it work as a charm. Downvoting my previous comment. |
I ran into the same bug and can confirm it didn't reproduce with TensorFlow version 1.15.0 |
I have the same issue with TensorFlow 1.15.0 on Debian buster. The workaround mentioned above did not resolve the problem. |
@lucaro The workaround was for the time there was no new release. Have you tested with |
Yes, I tried it with 1.15.0 with and without the workaround but it doesn't work either way. |
I was asking because for me it works inside Intellij but when I make a Fat JAR it gives me:
I was sure it was just me since everyone upgraded to 1.15.0 without reporting this issue. |
OK, this issue still remains on Ubuntu (16.04 at least). The problem is that it's only copy This is what's inside my compiled JAR (sbt assembly with TF 1.15.0)
For some reason on Ubuntu 16.04 it only copies |
@maziyarpanahi Is that with the workaround or with plain 1.15? |
@geometrikal With the plain 1.15.0. However, if I copy the That is why I think this issue still exists at least on some OSes or when you compile a fat JAR. |
Same issue with 1.15.0 on Ubuntu 16.04 and macOS 10.15.3 The problem is in
META-INF/MANIFEST.MF in the fatJar which may not be provided ( my case) or does not match the tensorflow major version (1 in this case), so it returns null and causes the missing libtensorflow_framework.1.dylib or libtensorflow_framework.so.1 .
I think it needs a more reliable way to get the version. One workaround is to provide the implementation-version in manifest like the following in gradle
|
I just successfully tested this workaround on Debian buster. |
@larryrxu |
well actually i meet this issue in tensorflow1.13.1 when I run the java app with self-compiled tensorflow with bazel, the document says the java only need libtensorflow.jar and libtensorflow_jni.so but actually libtensorflow_framework.so is also needed when i run my project. I had to build a directory with both so file and insert them into the official maven tensorflow-jni dependency JAR. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
The issue still exists even in the 1.15 release which we still had to manually add the workaround mentioned earlier (which thank you @geometrikal) and the last post is from a week ago so how is this a stalled issue? |
Closing as stale. Please reopen if you'd like to work on this further. |
I am experiencing same issue with TF 1.15 maven artifacts. |
If using ivy, make sure your lib does not have older versions of libtensorflow or tensorflow. Removing the older versions and using 1.15.0 resolved the problem for our java project. The ivy.xml lines we use are
|
Java version upgrade from 1.13.1 to 1.14.0 got error
System information
Log with 1.13.1(Worked):
Log with 1.14.0(Failed):
This is my pom.xml:
4.0.0
And what I did was changed version from 1.13.1 to 1.14.0.
And I tried official Java start up got the same error:
System information
pom.xml:
4.0.0
App.java:
Log:
The text was updated successfully, but these errors were encountered: