Skip to content
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

Java 17 virtual machine issue: py5 Thonny Macbook M1 Max #452

Closed
david-dunkley opened this issue May 1, 2024 · 13 comments
Closed

Java 17 virtual machine issue: py5 Thonny Macbook M1 Max #452

david-dunkley opened this issue May 1, 2024 · 13 comments

Comments

@david-dunkley
Copy link

Hi,
I'm trying to run py5 in thonny and have received the following error.
Any suggestions would be helpful. My MacBook chip is Apple M1 max. OS is ventura 13.5.2. Thanks
py5_ Thonny_Mac2024-05-01 at 1 47 34 PM

@villares
Copy link
Collaborator

villares commented May 2, 2024

Hi @david-dunkley !

I'm sorry that you are having trouble with this, but I'm glad you opened this issue so we might investigate this, solve it for you and eventually solve it for everyone using Thonny and the py5 plug-in for Thonny... From your screen capture I gather you are using Thonny IDE and the thonny-py5mode plug-in, right?

Can you please open on Thonny's menu Tools > Options... then on General Tab check if there is JAVA_HOME=... on the Environment Variables box? Does the path there seem sensible? Can you check if it points to an existing folder?

My next steps would be to ask you to try using the most recent install-jdk library (which the plug-in uses) install a (new? correct?) JDK... I would give you more instructions. But then, you could also try to manually install a working JDK... what do you think?

@villares
Copy link
Collaborator

villares commented May 2, 2024

You will, hopefully, be helping us fix this related issue: tabreturn/thonny-py5mode#55

@hx2A
Copy link
Collaborator

hx2A commented May 2, 2024

Thank you, @villares !

I'll also note that the error message mentions "amazon corretto 11" as the default Java version. py5 requires Java 17 or higher. Also, I am not familiar with amazon corretto JVMs and would suggest you stick with oracle or openjdk instead.

@david-dunkley
Copy link
Author

Thanks @villares and @hx2A ! I will try to fix this using your suggestions! py5 does work on my machine when I use a virtual environment in PyCharm, but I wanted to also get Thonny going as well.

@villares
Copy link
Collaborator

villares commented May 2, 2024

Cheers David!

So, just to make it work, I would try to find your "working" JDK and add the path to it to Thonny's JAVA_HOME env var settings in options.

UPDATE: You could also try pointing Thonny to your PyCharm env Python under Otions > Interpreter, maybe?

If you want to explore more I would try to uninstall the thonny-py5mode plugin, then install with Thonny packages manager the latest install-jdk library and py5 and then re-install the plug-in to see if it works...

@hx2A
Copy link
Collaborator

hx2A commented May 2, 2024

Also, since this is using Apple Silicon, be aware of this issue:

https://blogs.oracle.com/java/post/java-on-macos-14-4

@david-dunkley
Copy link
Author

Hi @villares & @hx2A ,

I fixed the problem by removing the old jdks from the library. The amazon-corretto-17.jdk proved stubborn as I had to change its name to simply jdk-17. Then I did a: sudo rm - rf /Library/Java/JavaVirtualMachines/jdk-17.jdk to remove. Now Thonny finds the pathway I set up within it. Thanks again and py5 is really great.

@david-dunkley
Copy link
Author

...I also installed home-brew and installed java jdk 21 through openjdk. Hope this helps if any Mac M1 users need it!

@hx2A
Copy link
Collaborator

hx2A commented May 2, 2024

Awesome @david-dunkley , very happy you have it working! If you have any more problems or ideas, you know where to find us!

Also, since you have the problem fixed, can we close this?

@david-dunkley
Copy link
Author

Yes, @hx2A we can close the issue. Thanks!

@LeMasters
Copy link

With the latest install of Thonny on a Mac m3, I'm getting the same error.

py5 is unable to start a Java 17 Virtual Machine.
This library requires Java 17 to be installed and a properly set JAVA_HOME environment variable.
Here is some debug info about your installation that might help you identify the source of this problem.
{'JAVA_HOME environment variable': '/Users/garrisonlemasters/Library/Thonny/jdk-17', 'jvm version': (0, 0, 0), 'default jvm path': '/Users/garrisonlemasters/Library/Thonny/jdk-17/Contents/Home/lib/libjli.dylib'}

In the Thonny TOOLS>OPTIONS panel, it lists the JAVA_HOME variable as above.

The default JVM path DOES contain the libjli.dylib file (among other things).

In my terminal, java -version tells me there's no java installed. echo $JAVA_HOME gives me a blank line.

I was faithful about following THONNY's install instructions. Is it best to uninstall everything and start by installing a free-standing version of the JDK independently of THONNY?

@villares
Copy link
Collaborator

Is it best to uninstall everything and start by installing a free-standing version of the JDK independently of THONNY?

Hi @LeMasters, I'm afraid it might be the best option, according to some reports I have been hearing from people.

You could then still use Thonny setting the JAVA_HOME variable in the preferences according to your independent install.

I would love to know if it would work using the jdk_install library as described in http://py5coding.org/content/install.html?highlight=jdk+install#install-java

If it doesn't work, maybe you could try "homebrew" with https://formulae.brew.sh/formula/openjdk@17

Please keep us posted on your progress! I hope this works!

@david-dunkley
Copy link
Author

david-dunkley commented Jun 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants