DynamicsAndNeuralSystems / pyspi

Comparative analysis of pairwise interactions in multivariate time series.
https://time-series-features.gitbook.io/pyspi/
GNU General Public License v3.0
198 stars 26 forks source link

No JVM DLL when using jpype #42

Closed rnartallo closed 5 months ago

rnartallo commented 8 months ago

When trying to initialise a calculator, the jpype methods are failing with the error FileNotFoundError: [Errno 2] JVM DLL not found: /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home/lib/libjli.dylib

I have set Java Home to the correct directory and the .dylib file appears to be there but it does not recognise it.

I am using a Mac ARM architecture and a conda virtual environment.

jmoo2880 commented 8 months ago

Hi @rnartallo, I encountered a similar issue with the Java JDK on my Mac (M1) ARM architecture and conda environment.

The fix was to install a very specific version of java JDK - AdoptOpenJDK11 version 11. While Eclipse Adoptium has their own build (temurin jdk-11) with support for Apple architecture, I didn't have much success with this particular release. What worked for me was to download the latest release of jdk-11 from AdoptOpen which has been archived here.

Once you have downloaded and run the .pkg file, you'll need to add your AdoptOpenJDK path to your jenv environments. You can find where the jdk files were installed using the following command:

/usr/libexec/java_home -V

Locate the path for AdoptOpenJDK11 and then paste it into the following:

jenv add <path_to_adopt_open_jdk_11>

You can confirm that AdoptOpenDJK was added to jenv by running jenv versions. Then, set JDK11 as your global Java version with the following:

jenv global <AdoptOpenJDK version>

I hope you find this useful. Let us know if you have any further issues.

rnartallo commented 8 months ago

Hello, at the archive site that you link, I can download the source code for ARM linux but there does not seem to be an ARM Mac. Also, when I download the linux one, there is no .pkg just source code.

jmoo2880 commented 8 months ago

In the "Assets" section, you will find a hyperlink labeled "Show All 101 Assets". If you click the link, it should give you access to all of the source code and .pkg files. While AdoptOpenJDK doesn't have native support for Apple ARM architecture, I managed to get jypype working with OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.pkg.

Give this a shot and let me know if it works for you.