DL4J UnsatisfiedLinkError:java.library.path中没有jniopenblas

时间:2023-01-22 09:05:34

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

我试图通过gradle设置deeplearning4j项目,但是我得到了一个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.

我需要安装OpenBlas吗?我没有在deeplearning4j的快速入门指南中阅读过这样的内容。操作系统是Win10,IDE是IntelliJ社区版。

4 个解决方案

#1


1  

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

nd4j-jblas甚至不是有效的maven依赖。你从哪里得到的确切?

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

我们的文档中没有任何地方的nd4j-jblas,现在已经存在了近2年。坚持我们的入门文档: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.

我们在那里解释你需要什么。而不是弄乱所有分类器只需使用:nd4j-native-platform作为工件id。

#2


1  

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

我将这些依赖项添加到我的POM.xml文件中,它正在运行。

<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>

#3


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"

我遇到了同样的问题,并设法通过将以下路径添加到您的环境变量路径来解决它:“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

用户名和D:\将特定于您的计算机,例如我的用户名是Arslan Akhtar,所以我的路径是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

在你的机器上转到编辑系统环境变量=>然后在系统变量下找到变量Path并选择Edit =>然后在添加分号(;)作为分隔符后,在长字符串的末尾添加上面提到的变量路径

#4


0  

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

根据文档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):

如果您在Windows机器上使用64位Java,则必须将以下内容添加为VM参数(在IntelliJ中运行 - >编辑配置 - > VM选项):

-Djava.library.path=""

#1


1  

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

nd4j-jblas甚至不是有效的maven依赖。你从哪里得到的确切?

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

我们的文档中没有任何地方的nd4j-jblas,现在已经存在了近2年。坚持我们的入门文档: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.

我们在那里解释你需要什么。而不是弄乱所有分类器只需使用:nd4j-native-platform作为工件id。

#2


1  

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

我将这些依赖项添加到我的POM.xml文件中,它正在运行。

<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>

#3


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"

我遇到了同样的问题,并设法通过将以下路径添加到您的环境变量路径来解决它:“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

用户名和D:\将特定于您的计算机,例如我的用户名是Arslan Akhtar,所以我的路径是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

在你的机器上转到编辑系统环境变量=>然后在系统变量下找到变量Path并选择Edit =>然后在添加分号(;)作为分隔符后,在长字符串的末尾添加上面提到的变量路径

#4


0  

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

根据文档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):

如果您在Windows机器上使用64位Java,则必须将以下内容添加为VM参数(在IntelliJ中运行 - >编辑配置 - > VM选项):

-Djava.library.path=""