Skip to content
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

Closed
larryrxu opened this issue Jul 12, 2019 · 35 comments
Closed

Java version upgrade from 1.13.1 to 1.14.0 got error #30635

larryrxu opened this issue Jul 12, 2019 · 35 comments
Assignees
Labels
stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues TF 1.14 for issues seen with TF 1.14 type:build/install Build and install issues

Comments

@larryrxu
Copy link

larryrxu commented Jul 12, 2019

Java version upgrade from 1.13.1 to 1.14.0 got error

System information

  • Ubuntu 18.04.2 LTS (GNU/Linux 4.18.0-1013-azure x86_64):
  • TensorFlow 1.14.0:
  • Java 1.8:

Log with 1.13.1(Worked):

/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
 '  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::        (v2.1.3.RELEASE)

2019-07-12 07:15:28.366  INFO 21194 --- [           main] com.springWeb.App                        : Starting App v0.0.1-SNAPSHOT on RaTceUbt2019 with PID 21194 (/home/RaTce2019/od/springWeb-0.0.1-SNAPSHOT.jar started by RaTce2019 in /home/RaTce2019/od)
2019-07-12 07:15:28.375  INFO 21194 --- [           main] com.springWeb.App                        : No active profile set, falling back to default profiles: default
2019-07-12 07:15:31.058  INFO 21194 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8765 (http)
2019-07-12 07:15:31.143  INFO 21194 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-12 07:15:31.143  INFO 21194 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-07-12 07:15:31.171  INFO 21194 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2019-07-12 07:15:31.362  INFO 21194 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-12 07:15:31.362  INFO 21194 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2885 ms
2019-07-12 07:15:31.940  INFO 21194 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-12 07:15:32.424  INFO 21194 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8765 (http) with context path ''
2019-07-12 07:15:32.432  INFO 21194 --- [           main] com.springWeb.App                        : Started App in 4.883 seconds (JVM running for 5.79)
2019-07-12 07:15:36.232  INFO 21194 --- [nio-8765-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-07-12 07:15:36.233  INFO 21194 --- [nio-8765-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-07-12 07:15:36.249  INFO 21194 --- [nio-8765-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 16 ms
2019-07-12 07:15:38.465576: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: models/pepsi/ssd/saved_model
2019-07-12 07:15:38.574596: I tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2019-07-12 07:15:38.614832: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
2019-07-12 07:15:38.621862: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2200000000 Hz
2019-07-12 07:15:38.623574: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x7fe1c435d720 executing computations on platform Host. Devices:
2019-07-12 07:15:38.623614: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
2019-07-12 07:15:38.716123: I tensorflow/cc/saved_model/loader.cc:182] Restoring SavedModel bundle.
2019-07-12 07:15:38.716231: I tensorflow/cc/saved_model/loader.cc:192] The specified SavedModel has no variables; no checkpoints were restored. File does not exist: models/pepsi/ssd/saved_model/variables/variables.index
2019-07-12 07:15:38.716265: I tensorflow/cc/saved_model/loader.cc:285] SavedModel load for tags { serve }; Status: success. Took 250701 microseconds.

Log with 1.14.0(Failed):

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

2019-07-12 06:59:43.499  INFO 19308 --- [           main] com.springWeb.App                        : Starting App v0.0.1-SNAPSHOT on RaTceUbt2019 with PID 19308 (/home/RaTce2019/od/springWeb-0.0.1-SNAPSHOT.jar started by RaTce2019 in /home/RaTce2019/od)
2019-07-12 06:59:43.507  INFO 19308 --- [           main] com.springWeb.App                        : No active profile set, falling back to default profiles: default
2019-07-12 06:59:46.150  INFO 19308 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8765 (http)
2019-07-12 06:59:46.236  INFO 19308 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-12 06:59:46.237  INFO 19308 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-07-12 06:59:46.279  INFO 19308 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2019-07-12 06:59:46.447  INFO 19308 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-12 06:59:46.447  INFO 19308 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2844 ms
2019-07-12 06:59:47.007  INFO 19308 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-12 06:59:47.481  INFO 19308 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8765 (http) with context path ''
2019-07-12 06:59:47.490  INFO 19308 --- [           main] com.springWeb.App                        : Started App in 4.798 seconds (JVM running for 5.729)
2019-07-12 07:00:05.710  INFO 19308 --- [nio-8765-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-07-12 07:00:05.710  INFO 19308 --- [nio-8765-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-07-12 07:00:05.723  INFO 19308 --- [nio-8765-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 13 ms
2019-07-12 07:00:08.082 ERROR 19308 --- [nio-8765-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1562914806051-0/libtensorflow_jni.so: libtensorflow_framework.so.1: cannot open shared object file: No such file or directory] with root cause

java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1562914806051-0/libtensorflow_jni.so: libtensorflow_framework.so.1: cannot open shared object file: No such file or directory
	at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[na:1.8.0_212]
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) ~[na:1.8.0_212]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824) ~[na:1.8.0_212]
	at java.lang.Runtime.load0(Runtime.java:809) ~[na:1.8.0_212]
	at java.lang.System.load(System.java:1086) ~[na:1.8.0_212]
	at org.tensorflow.NativeLibrary.load(NativeLibrary.java:101) ~[libtensorflow-1.14.0.jar!/:na]
	at org.tensorflow.TensorFlow.init(TensorFlow.java:66) ~[libtensorflow-1.14.0.jar!/:na]
	at org.tensorflow.TensorFlow.<clinit>(TensorFlow.java:70) ~[libtensorflow-1.14.0.jar!/:na]
	at org.tensorflow.SavedModelBundle.<clinit>(SavedModelBundle.java:170) ~[libtensorflow-1.14.0.jar!/:na]
	at com.springWeb.controller.Controller.detectImage(Controller.java:73) ~[classes!/:0.0.1-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_212]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_212]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]

2019-07-12 07:00:26.038 ERROR 19308 --- [nio-8765-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.tensorflow.SavedModelBundle] with root cause

java.lang.NoClassDefFoundError: Could not initialize class org.tensorflow.SavedModelBundle
	at com.springWeb.controller.Controller.detectImage(Controller.java:73) ~[classes!/:0.0.1-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_212]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_212]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]

This is my pom.xml:


4.0.0

<groupId>springWeb</groupId>
<artifactId>springWeb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>springWeb</name>
<url>http://maven.apache.org</url>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<java.version>1.8</java.version>
	<maven.compiler.source>1.8</maven.compiler.source>
	<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.1.3.RELEASE</version>
</parent>

<dependencies>
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>org.tensorflow</groupId>
		<artifactId>tensorflow</artifactId>
		<version>1.14.0</version>
	</dependency>
	<dependency>
		<groupId>org.tensorflow</groupId>
		<artifactId>proto</artifactId>
		<version>1.14.0</version>
	</dependency>
	<dependency>
		<groupId>org.json</groupId>
		<artifactId>json</artifactId>
		<version>20180813</version>
	</dependency>
</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
	</plugins>
</build>

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

  • macOS High Sierra Version 10.13.6 (17G6030):
  • TensorFlow 1.14.0:
  • Java 1.8:

pom.xml:

4.0.0

<groupId>tftest</groupId>
<artifactId>tftest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>tftest</name>
<url>http://maven.apache.org</url>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>3.8.1</version>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.tensorflow</groupId>
		<artifactId>tensorflow</artifactId>
		<version>1.14.0</version>
	</dependency>
	<dependency>
		<groupId>org.tensorflow</groupId>
		<artifactId>libtensorflow</artifactId>
		<version>1.14.0</version>
	</dependency>
</dependencies>

App.java:


import org.tensorflow.Graph;
import org.tensorflow.Session;
import org.tensorflow.Tensor;
import org.tensorflow.TensorFlow;

public class App {
	public static void main(String[] args) throws Exception {
		try (Graph g = new Graph()) {
			final String value = "Hello from " + TensorFlow.version();
			// Construct the computation graph with a single operation, a constant
			// named "MyConst" with a value "value".
			try (Tensor t = Tensor.create(value.getBytes("UTF-8"))) {
				// The Java API doesn't yet include convenience functions for adding operations.
				g.opBuilder("Const", "MyConst").setAttr("dtype", t.dataType()).setAttr("value", t).build();
			}
			// Execute the "MyConst" operation in a Session.
			try (Session s = new Session(g);
					// Generally, there may be multiple output tensors,
					// all of them must be closed to prevent resource leaks.
					Tensor output = s.runner().fetch("MyConst").run().get(0)) {
				System.out.println(new String(output.bytesValue(), "UTF-8"));
			}
		}
	}
}

Log:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/0c/nz0823ps085b_1zcq6l8ry441kqw10/T/tensorflow_native_libraries-1562915587706-0/libtensorflow_jni.dylib: dlopen(/private/var/folders/0c/nz0823ps085b_1zcq6l8ry441kqw10/T/tensorflow_native_libraries-1562915587706-0/libtensorflow_jni.dylib, 1): Library not loaded: @rpath/libtensorflow_framework.1.dylib
  Referenced from: /private/var/folders/0c/nz0823ps085b_1zcq6l8ry441kqw10/T/tensorflow_native_libraries-1562915587706-0/libtensorflow_jni.dylib
  Reason: image not found
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
	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)
	at org.tensorflow.Graph.<clinit>(Graph.java:479)
	at tftest.tftest.App.main(App.java:10)
@ravikyram ravikyram self-assigned this Jul 15, 2019
@ravikyram
Copy link
Contributor

Just to verify after upgrading to TF 1.14.0 are you able to import Tensorflow in Java successfully.Thanks!

@ravikyram ravikyram added stat:awaiting response Status - Awaiting response from author TF 1.14 for issues seen with TF 1.14 labels Jul 15, 2019
@larryrxu
Copy link
Author

larryrxu commented Jul 16, 2019

Yes, import is success, but it seems libtensorflow.so was not found in tmp directory.
I got this Library not loaded: @rpath/libtensorflow_framework.1.dylib when I try to run TensorFlow.version(). Worked for 1.13.1 but not 1.14.0.
Thanks!

@davidmweber
Copy link

davidmweber commented Jul 16, 2019

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
org.tensorflow.NativeLibrary: jniResourceName: org/tensorflow/native/linux-x86_64/libtensorflow_jni.so
org.tensorflow.NativeLibrary: frameworkResourceName: org/tensorflow/native/linux-x86_64/libtensorflow_framework.so
org.tensorflow.NativeLibrary: extracting native library to: /tmp/tensorflow_native_libraries-1563269252070-0/libtensorflow_framework.so
org.tensorflow.NativeLibrary: copied 34748520 bytes to /tmp/tensorflow_native_libraries-1563269252070-0/libtensorflow_framework.so
org.tensorflow.NativeLibrary: extracting native library to: /tmp/tensorflow_native_libraries-1563269252070-0/libtensorflow_jni.so
org.tensorflow.NativeLibrary: copied 150449736 bytes to /tmp/tensorflow_native_libraries-1563269252070-0/libtensorflow_jni.so
[WARNING]
java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1563269252070-0/libtensorflow_jni.so: libtensorflow_framework.so.1: cannot open shared object file: No such file or directory
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.(TensorFlow.java:70)
at org.tensorflow.Graph.(Graph.java:479)
at HelloTensorFlow.main(HelloTensorFlow.java:8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
at java.lang.Thread.run(Thread.java:748)

@ravikyram ravikyram added the type:build/install Build and install issues label Jul 16, 2019
@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Jul 16, 2019
@ravikyram ravikyram added the subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues label Jul 17, 2019
@ravikyram ravikyram assigned gunan and unassigned ravikyram Jul 17, 2019
@ravikyram ravikyram added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jul 17, 2019
@gunan gunan assigned sjamesr and unassigned gunan Jul 17, 2019
@Dcyx
Copy link

Dcyx commented Jul 22, 2019

same issue.
macOS 10.14.4
java version : 1.8.0_152
pom:

        <dependency>
            <groupId>org.tensorflow</groupId>
            <artifactId>libtensorflow</artifactId>
            <version>1.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.tensorflow</groupId>
            <artifactId>proto</artifactId>
            <version>1.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.tensorflow</groupId>
            <artifactId>libtensorflow_jni</artifactId>
            <version>1.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.tensorflow</groupId>
            <artifactId>tensorflow</artifactId>
            <version>1.14.0</version>
        </dependency>

exception :

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/3v/v52y0yq94kl2khm53q4848_m0000gn/T/tensorflow_native_libraries-1563783638694-0/libtensorflow_jni.dylib: dlopen(/private/var/folders/3v/v52y0yq94kl2khm53q4848_m0000gn/T/tensorflow_native_libraries-1563783638694-0/libtensorflow_jni.dylib, 1): Library not loaded: @rpath/libtensorflow_framework.1.dylib
  Referenced from: /private/var/folders/3v/v52y0yq94kl2khm53q4848_m0000gn/T/tensorflow_native_libraries-1563783638694-0/libtensorflow_jni.dylib
  Reason: image not found

@klarson2
Copy link

I experienced this on both Mac OS X and Linux.

Tracing through the org.tensorflow.NativeLibraryclass, it seems that what is happening is that the code is extracting the dependent framework lib without the version (i.e. libtensorflow_framework.dylib) to a temp directory for loading, but the dependency ("@rpath") in the JNI lib is for the framework lib with the version (i.e. libtensorflow_framework.1.dylib).

The same thing happens on Linux with .so files.

The NativeLibrary class needs to make sure it is extracting the flavor of the framework lib that the JNI lib is actually depending on.

I worked around this on Mac OS X by writing code to extract all the flavors and load the libs before NativeLibrary kicks in, but after seeing this defect in both platforms I think I will just revert to 1.13.1.

@silvanheller
Copy link

Can confirm this is an issue with 1.14.0 on OS X

@geometrikal
Copy link

geometrikal commented Aug 20, 2019

Also have this problem in OSX, but not in Windows.

@silvanheller @klarson2 Here is a quick workaround:

  1. Create a package org.tensorflow in the top level of your source directory (e.g. src/org/tensorflow)

  2. Copy in the NativeLibrary.java file from here: https://github.com/tensorflow/tensorflow/blob/r1.14/tensorflow/java/src/main/java/org/tensorflow/NativeLibrary.java

  3. Change:

final String frameworkLibName =
                getVersionedLibraryName(System.mapLibraryName("tensorflow_framework"));

to

String frameworkLibName =
                getVersionedLibraryName(System.mapLibraryName("tensorflow_framework"));
if (frameworkLibName.equals("libtensorflow_framework.dylib")) frameworkLibName = "libtensorflow_framework.1.dylib";

@davidmweber I guess if it is the same error on linux you can also add

if (frameworkLibName.equals("libtensorflow_framework.so")) frameworkLibName = "libtensorflow_framework.so.1";

At least for me, this version overrides the one in the jar. Everything seems to work fine.

@maziyarpanahi
Copy link

Same for me in macOS 10.14.x, it works in 1.13.1 but have the error when I move to 1.14.0:

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)

@pcnfernando
Copy link

I'm experiencing the same issue with Ubuntu 16.04, Oracle JDK 1.8.0_201.
Works well with 1.13.1

@tastyminerals
Copy link

If you use Scala with Gradle, in addition to provided workaround you'll also need to modify your build.gradle.

sourceSets.main.scala.srcDir "src/main/java"
sourceSets.main.java.srcDirs = []

sourceSets.test.scala.srcDir "src/test/java"
sourceSets.test.java.srcDirs = []

mengxr added a commit to mengxr/tensorframes that referenced this issue Sep 18, 2019
jkbradley added a commit to databricks/tensorframes that referenced this issue Sep 18, 2019
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
@davidmweber
Copy link

Any chance of getting this pushed to maven?

@sjamesr
Copy link
Contributor

sjamesr commented Oct 4, 2019

The upcoming release of TF 1.15.0 will contain the fixes for this problem.

@mickaeltardy
Copy link

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.
The suggested workaround still works though.

@maziyarpanahi
Copy link

@mickaeltardy Are you sure? The reason I am asking is to be sure the cache is cleared and you are using only the 1.15.0 and nothing from the previous installation.
I haven't tested myself since we need to figure out where to find some .so files we need in cntorib but I saw some projects moved to 1.15.0 so I assumed it was fixed.

@mickaeltardy
Copy link

@mickaeltardy Are you sure? The reason I am asking is to be sure the cache is cleared and you are using only the 1.15.0 and nothing from the previous installation.
I haven't tested myself since we need to figure out where to find some .so files we need in cntorib but I saw some projects moved to 1.15.0 so I assumed it was fixed.

Thank you for pointing out for me. Properly cleaning dependencies made it work as a charm. Downvoting my previous comment.

@suyashcjoshi
Copy link

I ran into the same bug and can confirm it didn't reproduce with TensorFlow version 1.15.0

@lucaro
Copy link

lucaro commented Dec 2, 2019

I have the same issue with TensorFlow 1.15.0 on Debian buster. The workaround mentioned above did not resolve the problem.

@maziyarpanahi
Copy link

@lucaro The workaround was for the time there was no new release. Have you tested with 1.15.0?

@lucaro
Copy link

lucaro commented Dec 2, 2019

Yes, I tried it with 1.15.0 with and without the workaround but it doesn't work either way.

@maziyarpanahi
Copy link

I was asking because for me it works inside Intellij but when I make a Fat JAR it gives me:

java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1575293215388-0/libtensorflow_jni.so: libtensorflow_framework.so.1: cannot open shared object file: No such file or directory

I was sure it was just me since everyone upgraded to 1.15.0 without reporting this issue.

@maziyarpanahi
Copy link

maziyarpanahi commented Jan 2, 2020

OK, this issue still remains on Ubuntu (16.04 at least). The problem is that it's only copy libtensorflow_jni.so file in the /tmp directory and doesn't copy libtensorflow_framework.so.1 even though I can see it in my compiled JAR that these two files exist under linux-x86_64 in native.

This is what's inside my compiled JAR (sbt assembly with TF 1.15.0)

        0  2020-01-02 12:15   org/tensorflow/native/
        0  2020-01-02 12:15   org/tensorflow/native/darwin-x86_64/
        0  2020-01-02 12:15   org/tensorflow/native/linux-x86_64/
        0  2020-01-02 12:15   org/tensorflow/native/windows-x86_64/
    11419  2019-10-22 17:09   org/tensorflow/native/darwin-x86_64/LICENSE
   422253  2019-10-22 17:09   org/tensorflow/native/darwin-x86_64/THIRD_PARTY_TF_JNI_LICENSES
 28642820  2019-10-22 17:09   org/tensorflow/native/darwin-x86_64/libtensorflow_framework.1.dylib
284042344  2019-10-22 17:09   org/tensorflow/native/darwin-x86_64/libtensorflow_jni.dylib
    11419  2019-10-22 17:09   org/tensorflow/native/linux-x86_64/LICENSE
   422253  2019-10-22 17:09   org/tensorflow/native/linux-x86_64/THIRD_PARTY_TF_JNI_LICENSES
 35226832  2019-10-22 17:09   org/tensorflow/native/linux-x86_64/libtensorflow_framework.so.1
154073736  2019-10-22 17:09   org/tensorflow/native/linux-x86_64/libtensorflow_jni.so
    11419  2019-10-22 17:09   org/tensorflow/native/windows-x86_64/LICENSE
 78973440  2019-10-22 17:09   org/tensorflow/native/windows-x86_64/tensorflow_jni.dll

For some reason on Ubuntu 16.04 it only copies libtensorflow_jni.so and not libtensorflow_framework.so.1 as well.

@geometrikal
Copy link

@maziyarpanahi Is that with the workaround or with plain 1.15?

@maziyarpanahi
Copy link

@geometrikal With the plain 1.15.0.

However, if I copy the NativeLibrary.java file from 1.14, apply the workaround, it works in 1.15.0 on Ubuntu 16.04.

That is why I think this issue still exists at least on some OSes or when you compile a fat JAR.

@guozhaochen
Copy link

Same issue with 1.15.0 on Ubuntu 16.04 and macOS 10.15.3
This only happens when using a fat Jar. Works fine with gradle,

The problem is in

String version = NativeLibrary.class.getPackage().getImplementationVersion();
when getting the version. The implementation version is read from 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

 Jar {
    manifest {
        attributes 'Implementation-Version': '1.xx'
    }
}

@lucaro
Copy link

lucaro commented Apr 19, 2020

I just successfully tested this workaround on Debian buster.

@Saduf2019
Copy link
Contributor

@larryrxu
Is this still an issue.

@Saduf2019 Saduf2019 added the stat:awaiting response Status - Awaiting response from author label May 27, 2020
@Saduf2019 Saduf2019 self-assigned this May 27, 2020
@axelning
Copy link

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.

@google-ml-butler
Copy link

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.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Jun 3, 2020
@maziyarpanahi
Copy link

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?

@Saduf2019 Saduf2019 removed their assignment Jun 5, 2020
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@skeptisq
Copy link

skeptisq commented Aug 28, 2020

I am experiencing same issue with TF 1.15 maven artifacts.

@tobidelbruck
Copy link

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

        <!--tensorflow has native libraries, but handled fine with this dependeny - see https://www.tensorflow.org/install/lang_java -->
        <!--if having trouble loading the DLL, you might have to downgrade locally to version 1.5.0-->
        <!--make sure to delete newer versions of libtensorflow* and tensorflow* from lib/-->
        <dependency org="org.tensorflow" name="tensorflow" rev="1.15.0" />
        
        <!--to use GPU if you have an Nvida GPU installed, comment line above and use lines below with appropriate version of tensor flow. 
        You have to separately install Cuda toolkit  for this to work - see https://developer.nvidia.com/cuda-toolkit -->
        <dependency org="org.tensorflow" name="libtensorflow_jni_gpu" rev="1.15.0" />

rma-rripken added a commit to rma-rripken/calsurrogate that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues TF 1.14 for issues seen with TF 1.14 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests