UnsatisfiedLinkError: no nd4j in java.library.path #143

Closed
dripp1 opened this Issue May 23, 2016 · 3 comments

Projects

None yet

3 participants

@dripp1
dripp1 commented May 23, 2016

I try to run (on Windows 7/IntelliJIDEA/Gradle/Java 8.0/64 bit) the following:

new Word2Vec.Builder()
          .batchSize(WORD_2_VEC_BATCH_SIZE)
          .minWordFrequency(WORD_2_VEC_MIN_WORD_FREQUENCY)
          .useAdaGrad(false)
          .layerSize(WORD_FEATURE_VECTOR_SIZE)
          .iterations(WORD_2_VEC_ITERATIONS)
          .learningRate(WORD_2_VEC_INITIAL_LEARNING_RATE)
          .minLearningRate(WORD_2_VEC_MIN_LEARNING_RATE)
          .negativeSample(WORD_2_VEC_NEGATIVE_WORDS_SAMPLE_SIZE)
          .seed(RANDOM_SEED)
          .windowSize(WORD_2_VEC_WINDOW_SIZE)
          .iterate(lineSentenceIterator)
          .tokenizerFactory(tokenizerFactory)
          .build();

and I get this error:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    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:483)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:130)
Caused by: java.lang.UnsatisfiedLinkError: no jnind4j in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1119)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
    at org.bytedeco.javacpp.Loader.load(Loader.java:492)
    at org.nd4j.nativeblas.NativeOps.<clinit>(NativeOps.java:29)
    at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:14)
    at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:9)
    at org.nd4j.linalg.jcublas.ops.executioner.JCudaExecutioner.<clinit>(JCudaExecutioner.java:67)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:259)
    at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:4743)
    at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:4716)
    at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:148)
    at org.deeplearning4j.models.embeddings.inmemory.InMemoryLookupTable$Builder.<init>(InMemoryLookupTable.java:640)
    at org.deeplearning4j.models.sequencevectors.SequenceVectors$Builder.presetTables(SequenceVectors.java:656)
    at org.deeplearning4j.models.word2vec.Word2Vec$Builder.build(Word2Vec.java:426)
    at om.data.sentiment.ConvolutionalNeuralNetwork.trainDomainVectors(ConvolutionalNeuralNetwork.java:449)
    at om.data.sentiment.ConvolutionalNeuralNetwork.loadWord2VecTrainedData(ConvolutionalNeuralNetwork.java:402)
    at om.data.sentiment.ConvolutionalNeuralNetwork.loadOrTrainNeuralNetwork(ConvolutionalNeuralNetwork.java:269)
    at om.data.sentiment.ConvolutionalNeuralNetwork.train(ConvolutionalNeuralNetwork.java:187)
    at om.data.sentiment.ConvolutionalNeuralNetwork.init(ConvolutionalNeuralNetwork.java:247)
    at om.data.sentiment.ConvolutionalNeuralNetwork.<init>(ConvolutionalNeuralNetwork.java:136)
    at om.data.sentiment.ConvolutionalNeuralNetwork.main(ConvolutionalNeuralNetwork.java:160)
    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:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
    ... 5 more
Caused by: java.lang.UnsatisfiedLinkError: no nd4j in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1119)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
    at org.bytedeco.javacpp.Loader.load(Loader.java:483)
    ... 29 more

My Gradle dependencies look like this:

compile (group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '0.4-rc3.9'){ exclude group: 'org.slf4j' }
    compile group: 'org.deeplearning4j', name: 'deeplearning4j-nlp', version: '0.4-rc3.9'
    compile group: 'org.deeplearning4j', name: 'dl4j-spark', version: '0.4-rc3.9'
    compile group: 'org.nd4j', name: 'nd4j-native', version: '0.4-rc3.9'
    compile group: 'org.nd4j', name: 'nd4j-native', version: '0.4-rc3.9:windows-x86_64'
    compile group: 'org.nd4j', name: 'nd4j-cuda-7.5', version: '0.4-rc3.9'
    compile (group: 'org.nd4j', name: 'canova-api', version: '0.0.0.15'){ exclude group: 'org.slf4j' }
    compile (group: 'org.nd4j', name: 'canova-nd4j-codec', version: '0.0.0.15'){ exclude group: 'org.slf4j' }
    compile (group: 'org.bytedeco', name: 'javacpp', version: '1.2'){ exclude group: 'org.slf4j' }

What is wrong or missing with my setup? Do I need to build and install some C++ dlls?

@dripp1
dripp1 commented May 23, 2016

BTW - the line
compile group: 'org.nd4j', name: 'nd4j-native', version: '0.4-rc3.9:windows-x86_64'
does not seem to bring anything from the repository. Maybe this is the problem?

@treo
Member
treo commented May 23, 2016

that looks like your problem. The line 'org.nd4j:nd4j-native:0.4-rc3.9:windows-x86_64' doesn't resolve to what you made out of it, since the last part isn't part of the version. It is a classifier. So I would guess, in your notation it should be:
compile group: 'org.nd4j', name: 'nd4j-native', version: '0.4-rc3.9', classifier: 'windows-x86_64'

@dripp1
dripp1 commented May 24, 2016

Thank you. Now it downloaded the proper jar.

@agibsonccc agibsonccc closed this May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment