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

org.platanios.tensorflow.jni.NotFoundException #190

Open
shilkazx opened this issue Jan 1, 2021 · 5 comments
Open

org.platanios.tensorflow.jni.NotFoundException #190

shilkazx opened this issue Jan 1, 2021 · 5 comments

Comments

@shilkazx
Copy link

shilkazx commented Jan 1, 2021

Platform: Archlinux x86_64, with Arch's official tensorflow-opt 2.3.1-7 package installed.
Scala version: 2.12.12

After import org.platanios.tensorflow.api._, I just try the simple snippet:
val t1 = Tensor(1.2, 4.5)
then scala throw the following error:

org.platanios.tensorflow.jni.NotFoundException: /tmp/tensorflow_scala_native_libraries18100586144836986571/libtensorflow_ops.so: undefined symbol: _ZN10tensorflow8OpKernel11TraceStringEPNS_15OpKernelContextEb
at org.platanios.tensorflow.jni.TensorFlow$.loadOpLibrary(Native Method)
at org.platanios.tensorflow.jni.TensorFlow$.$anonfun$load$6(TensorFlow.scala:101)
at scala.collection.immutable.List.foreach(List.scala:431)
at org.platanios.tensorflow.jni.TensorFlow$.load(TensorFlow.scala:101)
at org.platanios.tensorflow.jni.TensorFlow$.(TensorFlow.scala:169)
at org.platanios.tensorflow.jni.TensorFlow$.(TensorFlow.scala)
at org.platanios.tensorflow.jni.Tensor$.(Tensor.scala:24)
at org.platanios.tensorflow.jni.Tensor$.(Tensor.scala)
at org.platanios.tensorflow.api.tensors.Tensor$.fill(Tensor.scala:842)
at org.platanios.tensorflow.api.tensors.Implicits.tensorFromSupportedType(Implicits.scala:32)
at org.platanios.tensorflow.api.tensors.Implicits.tensorFromSupportedType$(Implicits.scala:31)
at org.platanios.tensorflow.api.package$.tensorFromSupportedType(package.scala:21)
at org.platanios.tensorflow.api.implicits.Implicits.doubleToTensor(Implicits.scala:62)
at org.platanios.tensorflow.api.implicits.Implicits.doubleToTensor$(Implicits.scala:61)
at org.platanios.tensorflow.api.package$.doubleToTensor(package.scala:21)
at $line3.$read$$iw$$iw$$iw$$iw$.(:14)
at $line3.$read$$iw$$iw$$iw$$iw$.()
at $line3.$eval$.$print$lzycompute(:7)
at $line3.$eval$.$print(:6)
at $line3.$eval.$print()
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:747)
at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:1020)
at scala.tools.nsc.interpreter.IMain.$anonfun$interpret$1(IMain.scala:577)
at scala.reflect.internal.util.ScalaClassLoader.asContext(ScalaClassLoader.scala:41)
at scala.reflect.internal.util.ScalaClassLoader.asContext$(ScalaClassLoader.scala:37)
at scala.reflect.internal.util.AbstractFileClassLoader.asContext(AbstractFileClassLoader.scala:41)
at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:576)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:603)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:573)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:865)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:733)
at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:435)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:456)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:1048)
at xsbt.ConsoleBridge.run(ConsoleBridge.scala:75)
at sbt.internal.inc.AnalyzingCompiler.console(AnalyzingCompiler.scala:209)
at sbt.Console.console0$1(Console.scala:64)
at sbt.Console.$anonfun$apply$5(Console.scala:73)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:17)
at sbt.TrapExit$App.run(TrapExit.scala:258)
at java.base/java.lang.Thread.run(Thread.java:834)

Btw. I also run a python version tensorflow sample on the same environment, everything is fine.
I've already done some google work, but found nothing helpful. Please help me. Thanks a million.

@akopich
Copy link

akopich commented Feb 7, 2021

I experience exactly the same issue. I run Archlinux and tried tensorflow-opt package too. I've also built tensorflow from source to the same effect.

@novakov-alexey-zz
Copy link

@akopich, @shilkazx if you can test with Ammonite, you can try below simple script.

test.sc :

// scala 2.13.4

interp.load.ivy(
  ("org.platanios" %% "tensorflow" % "0.5.10").withClassifier("linux")
)

import $ivy.`org.platanios::tensorflow:0.5.10`

import org.platanios.tensorflow.api._

val t1 = Tensor(1.2, 4.5)
println(t1.summarize())

It should print:

Tensor[Double, [2]]
[1.2, 4.5]

It should also work with SBT like this:

lazy val root = (project in file("."))
  .settings(
    name := "tensorflow-ann",
    libraryDependencies ++= Seq(
      "org.platanios" %% "tensorflow" % "0.5.10" classifier "linux"     
    )
  )

@akopich
Copy link

akopich commented Feb 8, 2021

@novakov-alexey thank you. I had the classifier "linux" part missing.

@akopich
Copy link

akopich commented Feb 8, 2021

@novakov-alexey but wait, doesn't it just pull the generic binaries from the repo? I removed the tensorflow-related packages and the code still works.

@novakov-alexey-zz
Copy link

@akopich welcome. Platform specific jar from Maven central contains dyn libs that are eventually used by JVM+JNI. I think @eaplatanios can clarify this moment better than I.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants