-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JVM DLL not found. Apple m1 #994
Comments
Is there a lib directory under Home? |
yes there is a lib directory. Btw I installed oracle JDK 8, and the library is able to run without problem. I guess the issue is with the zulu JDK |
I had the same mistake. using mac m1 python3.9 JPype==1.3.0 Traceback (most recent call last): but i have |
I also ran into this issue. Python version: Java Version |
What is the setting of JAVA_HOME and what is the contents of the JAVA_HOME directory? |
Here is some more information.
Result as mentioned before:
And finally:
|
It seems like the error message is deceiving in this case as the file is clearly present. The issue is how to figure out what the real error is. My first thought would be making sure that the library actually exists and is a valid binary. The error message was issued from the code in native/common/jp_exception.cpp
But this is just the error handler. The actual source of the error is native/common/jp_platform.cpp
The key part is the error number. We are currently getting as 0, which is not a valid value as far as I am aware. So the reason for the fail is dlopen returned NULL but did not set an errno. So to make headway we would need to find some way to print additional diagnostics as to why dlopen did not work. I know of no reason for a NULL without an errno. |
An explicit chmod+x on the library did not change anything. |
My best guess is that it is related to this ticket. Unfortunately I don't have access to such a system so I can't really test to see if this is a solution. |
Reading some of the documentation on "notarized" shared libraries it seems very likely this is the issue. I can't find any technical documentation on how the model operates that would give me a way to catch and resolve this error from within JPype. The apparent issue is that Python and JPype are installed at one protection level and Java was installed at another and thus calls to dlopen will fail. The solution is to have all at the same privilege level (likely by using a copy of Java outside of /Library). Why the error is silent preventing us from issuing a proper error is baffling. Without some error message that I can propagate to user there is no way this will not create endless headaches and support tickets. At best I could check if the file exists and is executable and if it still fails change the error message to something that indicates an unspecified permission error. There is nothing about this in the online man pages that I can access. Other python libraries have similar issues in that if one piece is not notarized then the process fails. |
@Thrameos I am not sure that this is the case here. In my Installation the Java is installed into the home directory. The “system Java” that resides in Library should not be involved at all. Or am I mistaken? |
I think it has something to do with which applications on the system are signed and located in trusted paths. If Python and JPype were signed but Java was not then it would fail. The same is true in the reverse case. Unfortunately I don't know enough about the process to determine which is signed and which are not, nor do I have technical specs on how to make sure this is even the right solution. I am afraid we would need an apple expert to weigh in. Here is the only example I found thus far. https://docs.azul.com/prime/Native-Application Is there a libjvm.so file as well as the dylib file? Maybe we are trying to load the wrong file? If so manually give a path to startJVM with the so file and see if that fixes it. The next most likely problem is that the LD_LIBRARY_PATH is missing something the shared library requires. I remember a case in which I had to add the $JAVA_HOME/bin to LD_LIBRARY_PATH because some shared library was in bin for unknown reason. There should be a utility that scans a shared library and tells if all the shared library dependencies can be satisfied. Also from that doc it appears there is a function called |
@Thrameos I made added the printf statements and compiled jpype locally. The printed messages are:
I guess that the problem is that the JDK that is used here, is not native for M1. When the java excutable is called directly, I guess that the Rosetta framework kicks in but this does not seem to be the case here. I will try to find a JDK that has been compiled for M1 natively next. |
Okay it sounds like the issue is identified. Python and the JVM must be the same architecture. I can try to improve the error message though it won't fix the underlaying issue. |
Making the error message more precise may help others. I guess that it would have saved me 3 hours of debugging. |
I ran into this problem and I managed to fix it by installing an M1-native JVM (azul OpenJDK, .dmg version), following the instructions from this thread: https://stackoverflow.com/questions/64788005/java-jdk-for-apple-m1-chip/64881417#64881417 |
Hi, i tried to download all versions of the jdk (the arm ones), it does not seem to work... But i tried to download the x86 one and it magically did work. Maybe you should try both the arm and the x86 versions |
The architecture of python and the jdk must match. So if python is x86 then the jdk must be as well. |
That makes perfect sense! Thank you |
I got the same error. I changed the java that is used in /usr/bin to my newly-installed Zulu11 java: /Applications/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64/bin/java Then it works for me. Basically, in the ~/.bash_profile or ~/.zshrc, you add |
The following solution worked for me: (based on: https://stackoverflow.com/questions/64788005/java-jdk-for-the-apple-m1-chip/64881417#64881417) Use |
I solved this problem by
|
None of the above solutions worked for me, but this did: https://pyspi-toolkit.readthedocs.io/en/latest/faq.html The AdoptOpenJDK appears to be the ticket for the M1 and M2 chips, for a Python-compatible library. |
What worked for me recently is using the ARM64 JDK as suggested in https://stackoverflow.com/a/74398849 |
就是版本的问题,之前安装的是官网下载的“jdk-8u371-macosx-x64.dmg”的x86版本,也有类似的问题, |
This above solution worked for me. |
When I download the tar.gz from step 1, I don't see there is file named libel.dylib. ib/jli/libjli.dylib is a file, it is not dir. Can you clarify step 3? |
I'm using Jaydebeapi to connect to Hive but it throws the below error. I tried with both JDK 8 and 15.
I've added the JAVA_HOME in .zshrc file at the end:
The text was updated successfully, but these errors were encountered: