ninia / jep

Embed Python in Java
Other
1.27k stars 146 forks source link

Cannot run the basic example in Python 3.10 #497

Closed aghasemi closed 6 months ago

aghasemi commented 9 months ago

Describe the bug Hello,

Running the example below on Ubunru 22.04 leads to the UnsatisifiedLinkError, although JAVA_HOME is installed and jep package is installed via pip.

//DEPS black.ninia:jep:4.1.1

import jep.NDArray;
import jep.SharedInterpreter;

public class JEPTest {
    static {

        System.out.println("JEP: "+System.getProperty("java.version"));

    }

    public static void main(String[] args) {

        try(SharedInterpreter py = new SharedInterpreter()) 
        {
            float[] f = new float[] { 1.0f, 2.1f, 3.3f, 4.5f, 5.6f, 6.7f };
            NDArray<float[]> nd = new NDArray<>(f, 3, 2);
            py.set("x", nd);
        }

    }
}

Is it because of Python 3.10 (or Java 20)?

Thanks

bsteffensmeier commented 9 months ago

Have you already tried the steps in the FAQ.

aghasemi commented 9 months ago

Thanks for the hint. Using MainInterpreter.setJepLibraryPath("/usr/local/lib/python3.10/dist-packages/jep/libjep.so"); solved the issue.