Open soilstack opened 2 days ago
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 I have managed once to open a system shell form Thonny's Tools menu and then ran Jupyter Lab from it, but I haven't tried that lately.
@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()
@villares I really hope jpype 1.5.1 doesn't have some weird problem affecting windows machines.
I have bad news... Installing py5 in a fresh env gets jpype 1.5.1, and importing it like you showed to test .startJVM()
can start a Java 1.8 JVM, which it found by itself, but which doesn't help us. When I set JAVA_HOME to the JDK-17 path it fails, and so py5 fails too.
The only good news is that after downgrading jpype to 1.5.0 then everything worked.
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.
Hmm, I am confused. Are you saying that 1.5.1 can start Java 1.8 but not Java 17?
Kind of.
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.
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. If I don't set JAVA_HOME jpype runs by default on JRE-1.8.
So my fix was:
1) uninstalled all the java stuff i installed, etc.
2) Somehow i missed the more elaborate instructions at https://py5coding.org/content/install.html I created a new environment based on http://py5coding.org/files/install/py5_environment.yml
3) pip install install-jdk and jdk.install('17')
4) it still didn't work, so I had to create JAVA_HOME env var
5) it still didn't work, so I added %JAVA_HOME% to my PATH as well
Then it works......
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.
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 toJAVA_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.