1

I tried to set up a deeplearning4j project via gradle, but I get an UnsatisfiedLinkError:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopenblas in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:976)
    at org.bytedeco.javacpp.Loader.load(Loader.java:777)
    at org.bytedeco.javacpp.Loader.load(Loader.java:684)
    at org.bytedeco.javacpp.openblas.<clinit>(openblas.java:10)
    at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.setMaxThreads(CpuBlas.java:117)
    at org.nd4j.nativeblas.Nd4jBlas.<init>(Nd4jBlas.java:35)
    at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.<init>(CpuBlas.java:12)
    at org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory.createBlas(CpuNDArrayFactory.java:89)
    at org.nd4j.linalg.factory.BaseNDArrayFactory.blas(BaseNDArrayFactory.java:67)
    at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.getEnvironmentInformation(NativeOpExecutioner.java:1176)
    at org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner.printEnvironmentInformation(DefaultOpExecutioner.java:562)
    at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:6210)
    at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:6087)
    at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:201)
    at org.deeplearning4j.nn.conf.NeuralNetConfiguration$Builder.seed(NeuralNetConfiguration.java:777)
    at my.project.NeuralNetwork.main(NeuralNetwork.java:43)
Caused by: java.lang.UnsatisfiedLinkError: no openblas in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:976)
    at org.bytedeco.javacpp.Loader.load(Loader.java:765)
    ... 14 more

My dependencies look like:

dependencies {
    compile group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '0.9.1'
    compile group: 'org.deeplearning4j', name: 'rl4j', version: '0.9.1'
    compile group: 'org.nd4j', name: 'nd4j-native', version: '0.9.1'
    compile group: 'org.nd4j', name: 'nd4j-jblas', version: '0.9.1'
    compile group: 'org.nd4j', name: 'nd4j-api', version: '0.9.1'
    compile 'org.nd4j:nd4j-native:0.9.1:windows-x86_64'
}

I've also tried to add

compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.2.20-1.3'

but that didn't help.

Do I need to install OpenBlas? I didn't read such a thing in the Quick Start Guide for deeplearning4j. OS is Win10, IDE is IntelliJ Community Edition.

Sebastian
  • 5,721
  • 3
  • 43
  • 69

5 Answers5

1

nd4j-jblas isn't even a valid maven dependency. Where did you get that from exactly?

We don't have nd4j-jblas anywhere in our docs and it hasn't existed for nearly 2 years now. Stick to our getting started docs: http://deeplearning4j.org/quickstart

We explain what you need in there. Rather than messing with all the classifiers just use: nd4j-native-platform for the artifact id.

Adam Gibson
  • 3,055
  • 1
  • 10
  • 12
  • Thank you, { compile "org.deeplearning4j:deeplearning4j-core:0.9.1" compile "org.nd4j:nd4j-native-platform:0.9.1" } was enough to run it. – Sebastian Dec 27 '17 at 20:24
1

I added these dependencies to my POM.xml file and it is working.

<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>openblas</artifactId>
    <version>0.2.20-1.4</version>
</dependency>

<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>openblas-platform</artifactId>
    <version>0.2.20-1.4</version>
</dependency>
Rohith Joseph
  • 603
  • 1
  • 5
  • 17
0

I was having the same issue and managed to solve it by adding the following path to your environment variable path: "D:\Users\username\.javacpp\cache\bin"

The username and D:\ will be specific to your machine e.g mine username is Arslan Akhtar so my path is D:\Users\Arslan Akhtar.javacpp\cache\bin

On your machine go to Edit the system environment variables => Then under System variables find the variable Path and select Edit => Then just append the above mentioned variable path at the end of the long string after adding semicolon (;) as a delimiter

0

According to doc https://deeplearning4j.org/quickstart

If you are using 64-bit java on the windows machine then you have to add the following as a VM parameter (Run -> Edit Configurations -> VM Options in IntelliJ):

-Djava.library.path=""

Rakesh Chaudhari
  • 3,310
  • 1
  • 27
  • 25
0

I was getting the same error but it was solved by adding two new dependencies. It was a javacv dependency and a javacv-platform dependency you can get these dependencies at https://mvnrepository.com/. Don't forget to add dependencies with supporting versions.