Fork me on GitHub
#boot
<
2017-11-07
>
kanwei06:11:04

So I built tensorflow JNI and now have a directory with the tensorflow JAR file and dylib files. I can't for the life of me figure out how to add this directory as part of the classpath with boot. I can't build a POM (long story, but pretty much impossible). Anyone know how to add a one-off jar to the -cp with boot?

kanwei06:11:00

java -cp libtensorflow.jar:clojure-1.8.0.jar clojure.main
works, but have no idea how to translate that into a boot config

alandipert15:11:12

kanwei boot.pod/add-classpath should do it (https://github.com/boot-clj/boot/blob/master/doc/boot.pod.md#add-classpath), you can do that in your build.boot

alandipert15:11:43

note that if you're producing a jar or something from your build, the jar won't be in there unless you mvn install it and then make it a proper dependency

kanwei17:11:05

@alandipert

(set-env! :resource-paths #{"/Users/kanwei/Src/tensorflow-java/libtensorflow.jar"})
(add-classpath "/Users/kanwei/src/tensorflow-java/libtensorflow.jar")

kanwei17:11:25

java.net.MalformedURLException: no protocol: /Users/kanwei/src/tensorflow-java/libtensorflow.jar
    clojure.lang.ExceptionInfo: no protocol: /Users/kanwei/src/tensorflow-java/libtensorflow.jar
    line: 6

kanwei17:11:14

changing it to file:///Users gives

java.lang.IllegalAccessError: Context classloader is not a DynamicClassLoader
  clojure.lang.ExceptionInfo: Context classloader is not a DynamicClassLoader
    line: 5

alandipert17:11:46

kanwei no need for the set-env! piece, just: (require '[boot.pod :as pod]) (pod/add-classpath "/Users/kanwei/Src/tensorflow-java/libtensorflow.jar")

kanwei17:11:54

nice, that worked

kanwei17:11:08

any reason why there's both add-classpath and pod/add-classpath?

kanwei17:11:36

they seem to have totally different behavior despite the same name

alandipert17:11:09

one is in clojure.core, one is in boot.pod

alandipert17:11:40

the boot one isn't deprecated and does boot stuff

kanwei17:11:42

ah, had no idea clojure had that in core. Thanks for the help!

kanwei17:11:16

@alandipert another issue: I need to add

(System/setProperty "java.library.path" "/Users/kanwei/src/tensorflow-java")
as a parameter for the dylibs to load, but it doesn't work in the boot version, whereas the
-Djava.library.path
method works on the CLI

kanwei17:11:36

how do I setProperty on the new pod?

mateusz.fiolka17:11:40

Hi, is there a way to spawn a repl in cider for a single file boot script to execute it without a context of a project?

mateusz.fiolka17:11:17

Can't find the info in the wiki

mateusz.fiolka17:11:36

Ah, ok, I can just do boot repl and jack-in picard-facepalm

alandipert17:11:47

kanwei you can set BOOT_JVM_OPTIONS, eg BOOT_JVM_OPTIONS="-Djava.library.path=/Users/kanwei/src/tensorflow-java boot ...

alandipert18:11:10

setting it from clj is trickier, and i'm not sure works in java 9. but might still: https://github.com/boot-clj/boot/issues/185

kanwei18:11:30

@alandipert moving the dylib files into the root of the project folder is working

kanwei18:11:37

alright time to do some actual machine learning 🙂

alandipert18:11:56

yup, it's gross

seancorfield18:11:19

Anyone here using tools.deps yet? Anyone looking at Boot tasks to work with that library to support external deps.edn files?

seancorfield18:11:48

(I'm asking to see whether there's someone to work with on this or whether I'm going to be a trail blazer 🙂 )

mattyulrich19:11:58

Hi all - I'm trying to deploy my boot project to run headless but would like to retain the opportunity to connect via remote repl to adjust config while it's running. I tried playing with the repl task :server true option - but it doesn't seem to be properly fitting the bill. Any guidance out there on this type of deployment? Thanks!

alandipert20:11:36

mattyulrich how do you deploy, as standalone uberjar? as .war?

alandipert20:11:48

... or is boot the entrypoint?