bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.58k stars 1.58k forks source link

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnitensorflow in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib] #2271

Open mrv347 opened 2 months ago

mrv347 commented 2 months ago

Error log:

Debug: Loading class org.bytedeco.javacpp.presets.javacpp
Debug: Loading class org.bytedeco.javacpp.Loader
Debug: Loading library jnijavacpp
Debug: Failed to load for jnijavacpp: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Could not load Loader: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Loading class org.tensorflow.internal.c_api.global.tensorflow
Debug: Loading class org.tensorflow.internal.c_api.global.tensorflow
Debug: Loading library iomp5
Debug: Failed to load for iomp5: java.lang.UnsatisfiedLinkError: no iomp5 in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Loading library mklml
Debug: Failed to load for mklml: java.lang.UnsatisfiedLinkError: no mklml in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Loading library mklml_intel
Debug: Failed to load for mklml_intel: java.lang.UnsatisfiedLinkError: no mklml_intel in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Loading library tensorflow_cc
Debug: Failed to load for tensorflow_cc@.2: java.lang.UnsatisfiedLinkError: no tensorflow_cc in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Loading library tensorflow_framework
Debug: Failed to load for tensorflow_framework@.2: java.lang.UnsatisfiedLinkError: no tensorflow_framework in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Debug: Loading library jnitensorflow
Debug: Failed to load for jnitensorflow: java.lang.UnsatisfiedLinkError: no jnitensorflow in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnitensorflow in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2678)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
    at java.base/java.lang.System.loadLibrary(System.java:1890)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1832)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1423)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1234)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1210)
    at org.tensorflow.internal.c_api.global.tensorflow.<clinit>(tensorflow.java:12)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:398)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1289)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1234)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1226)
    at org.tensorflow.NativeLibrary.load(NativeLibrary.java:48)
    at org.tensorflow.TensorFlow.<clinit>(TensorFlow.java:157)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at org.tensorflow.SavedModelBundle.<clinit>(SavedModelBundle.java:619)
    at ten$.main(ten.scala:11)
    at ten.main(ten.scala)
Caused by: java.lang.UnsatisfiedLinkError: Could not find jnitensorflow in class, module, and library paths.
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1799)
    ... 16 more

I'm trying to use Tensorflow Java in a scala program. I have used the following jar files as dependencies in my program:

tensorflow-core-api-0.5.0.jar tensorflow-core-platform-0.5.0(1).jar tensorflow-1.15.0.jar protobuf-java-3.22.5.jar javacpp-1.5.9.jar libtensorflow_jni-1.15.0(1).jar tensorflow-jni_2.13-0.6.5.jar javacv-platform-1.5.9.jar libtensorflow_jni-1.15.0(2).jar tensorflow-1.0.0-1.3-linux-x86_64.jar

Java version - openjdk version "17.0.12" 2024-07-16 OpenJDK Runtime Environment (build 17.0.12+7-Ubuntu-1ubuntu222.04) OpenJDK 64-Bit Server VM (build 17.0.12+7-Ubuntu-1ubuntu222.04, mixed mode, sharing)

I couldn't locate jnitensorflow and jnijavacpp. I tried a few suggestions found in other posts. Can someone guide to resolve this error? But nothing worked for me. I'm new to this field.

saudet commented 2 months ago

Please try to follow the instructions at https://github.com/tensorflow/java