-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Python has problems finding the JVM? #563
Comments
What version of py5 have you installed here? The error message you received is unusual. Can you try installing java with the install-jdk library mentioned on the install page and unset JAVA_HOME? |
@soilstack , we will do what we can to help you here! Thank you for your interest in py5. @villares , can you assist here? You have more experience diagnosing these problems on Windows. |
Hi @soilstack ! I had exactly this message recently using jpype 1.5.1 (jpype1 on PyPI) but it worked with jpype 1.5.0, can you check your jpype version? (I even opened an issue at jpype's repo that we are investigating) As a workaround I have been using this pre-installed Python env from Thonny: https://github.com/villares/thonny-portable-with-py5/releases/download/2024-11-17/thonny-416-with-py5-windows-portable.zip |
@villares I really hope jpype 1.5.1 doesn't have some weird problem affecting windows machines. @soilstack , can you try this: import jpype
jpype.startJVM() |
I have bad news... Installing py5 in a fresh env gets jpype 1.5.1, and importing it like you showed to test Update: I found out and reported at the jpype issue that moving jdk-17 from inside Thonny to the default Windows Java folder seems like it helps jpype find the stuff it needs. We still have a problem with 1.5.1 failing in our "Thonny-based set up" :( |
Hmm, I am confused. Are you saying that 1.5.1 can start Java 1.8 but not Java 17? When jdk-17 is inside Thonny, is JAVA_HOME set? jpype should be able to find Java when it is in the usual locations for that OS. It won't know to look in a Thonny folder unless the environment variable is present. |
Kind of.
Yes, Thonny sets JAVA_HOME, that works fine on jpype 1.5.0 or, if I move the JDK out, it also works in 1.5.1. |
So my fix was:
|
Neat. Very happy it works for you, @soilstack ! Thank you for your persistence. Are you using jpype 1.5.1 or 1.5.0? I didn't know that number 5 would help here. @villares and I will take note of that for the future. |
I installed PY5 on 2 computers in my lab yesterday and experienced the issue described. I fixed it by setting 2 user environment variables according to the instructions at: https://jpype.readthedocs.io/en/latest/install.html Specifically: "On certain systems such as Windows 2016 Server, the JDK will not load properly despite JPype properly locating the JVM library. The work around for this issue is add the JRE bin directory to the system PATH. Apparently, the shared library requires dependencies which are located in the bin directory. If a JPype fails to load despite having the correct JAVA_HOME and system architecture, it may be this issue." The environment variables are:
A restart was required. |
Excellent, thank you @brandonhornmsdk for your investigations here. This seems to be related to the comment on a jpype issue thread that also says to add JAVA_HOME to the path. When they fix that bug, I think this issue with py5 will be resolved? |
Thank you very much @brandonhornmsdk, I'm also grateful that many (super nice) jpype people are working on it. Let's hope this will soon all be resolved. |
Windows 10 environment.
Installed
Java SE Development Kit 23.0.1
Set system environment variable
JAVA_HOME = C:\Program Files\Java\jdk-23\bin
(earlier i set it to
JAVA_HOME = C:\Program Files\Java\jdk-23
and it had the same problemAt a dead-end here. I am trying to install py5 so that I can use it in my jupyter notebook world.
The text was updated successfully, but these errors were encountered: