Code Monkey home page Code Monkey logo

Comments (20)

hx2A avatar hx2A commented on August 26, 2024 2

Hi @ericof !

If you set JAVA_HOME to point to the same JDK that Thonny is attempting to use, does it work? Is jdk-install somehow installing a JDK that does not work on Apple Silicon machines?

It happens I now have a M1 Mac and I will have some time next week to investigate this.

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024 1

I think @tabreturn has one? He had one when he opened this issue.

from thonny-py5mode.

villares avatar villares commented on August 26, 2024 1

Please @tabreturn and @ericof and anyone with Apple Silicon, can we please check this? I'm trying to reach a student with a M1 today, let's see how it goes...

from thonny-py5mode.

villares avatar villares commented on August 26, 2024 1

Hi @ericof and @tabreturn, it would be great if we could check this JDK install thing and coordinate a fix or a warning in a new thonny-py5mode release soon.

The numpy 2.0 update, and the ability to avoid it by using the newest py5 version, makes a new release kind of a pressing issue.

from thonny-py5mode.

ericof avatar ericof commented on August 26, 2024 1

@villares, @tabreturn, I tried to install everything from scratch on my M1 computer, but it did not have a positive outcome.

The error message is the following:

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/ericof/Library/Thonny/jdk-17', 'jvm version': (0, 0, 0), 'default jvm path': '/Users/ericof/Library/Thonny/jdk-17/Contents/Home/lib/libjli.dylib'}
Traceback (most recent call last):
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/py5_tools/tools/run_sketch.py", line 52, in <module>
    main()
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/py5_tools/tools/run_sketch.py", line 44, in main
    imported.run_code(
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/py5_tools/imported.py", line 135, in run_code
    _run_code(
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/py5_tools/imported.py", line 259, in _run_code
    _run_sketch(sketch_path, classpath, exit_if_error)
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/py5_tools/imported.py", line 196, in _run_sketch
    import py5
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/py5/__init__.py", line 72, in <module>
    raise RuntimeError("py5 is unable to start Java 17 Virtual Machine")
RuntimeError: py5 is unable to start Java 17 Virtual Machine

Also, running the following code on the Thonny shell:

>>> import jpype
>>> jpype.startJVM()

The following error was raised:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ericof/Library/Thonny/plugins/lib/python/site-packages/jpype/_core.py", line 224, in startJVM
    _jpype.startup(jvmpath, tuple(args),
FileNotFoundError: [Errno 2] JVM DLL not found: /Users/ericof/Library/Thonny/jdk-17/Contents/Home/lib/libjli.dylib

Important points:

  • /Users/ericof/Library/Thonny/jdk-17 does exist
  • /Users/ericof/Library/Thonny/jdk-17/Contents/Home/lib/libjli.dylib does exist
  • Outside Thonny I have the following setting: JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home that is used by my other py5 installation, and it works like charm

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024 1

@hx2A I just tested it, and it will not work either. One important point, Thonny sets:

JAVA_HOME=/Users/ericof/Library/Thonny/jdk-17/

My working installation points to

JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home

Attention to the /Contents/Home (I also tried to set JAVA_HOME pointing to /Users/ericof/Library/Thonny/jdk-17/Contents/Home, but it did not work as well)

Interesting. Is @vsquared's post here helpful to you?

py5coding/py5generator#464 (comment)

Recently I purchased a Apple Silicon M1 laptop. I installed Thonny and this plugin using the install steps. I didn't previously install Java or py5 anywhere else on the machine. Thonny was able to run py5 without any problems. The install steps worked perfectly. Which is unfortunate, because I was hoping to reproduce a M1 related problem.

As I learn more about this machine and setup, I hope to experience some MacOS problems so I can find solutions to them.

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024 1

@hx2A and @ericof , can you both please clarify which version of the installing instructions you used?

I followed the instructions on the plugin github page:

https://github.com/tabreturn/thonny-py5mode

I did not install java or py5 before I installed the plugin. The plugin setup process did both of those for me.

from thonny-py5mode.

ericof avatar ericof commented on August 26, 2024 1

I will remove Thonny (I have this old app called TrashMe that claims to scrub any installation) and try to install it again following the documentation.
Of course, I will keep my other working Java environment (as it is used by some Brazilian Government apps that I need to use on a regular basis)

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024

Does the maintainer of install-jdk know about this issue? I recall he seemed pretty diligent about investigating problems.

from thonny-py5mode.

villares avatar villares commented on August 26, 2024

Does the maintainer of install-jdk know about this issue? I recall he seemed pretty diligent about investigating problems.

I saw a related issue at their repo, closed, not too long ago. The problem is I'm unable/unwilling to open a new issue there without being able to reproduce, or at least describe precisely, the problem :(

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024

The problem is I'm unable/unwilling to open a new issue there without being able to reproduce, or at least describe precisely, the problem

That is the right thing to do.

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024

This doesn't happen on all M1,M2, and M3 machines, right? Just some of the time?

from thonny-py5mode.

villares avatar villares commented on August 26, 2024

This doesn't happen on all M1,M2, and M3 machines, right? Just some of the time?

I really don't know :( The only Macs I have access to are Intel.

from thonny-py5mode.

ericof avatar ericof commented on August 26, 2024

@hx2A I just tested it, and it will not work either.
One important point, Thonny sets:

JAVA_HOME=/Users/ericof/Library/Thonny/jdk-17/

My working installation points to

JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home

Attention to the /Contents/Home
(I also tried to set JAVA_HOME pointing to /Users/ericof/Library/Thonny/jdk-17/Contents/Home, but it did not work as well)

from thonny-py5mode.

ericof avatar ericof commented on August 26, 2024

Additional information: if I set, on Thonny, JAVA_HOME to the other installation, it works

from thonny-py5mode.

villares avatar villares commented on August 26, 2024

@hx2A and @ericof , can you both please clarify which version of the installing instructions you used?

  • py5coding,org ... install ... has some install variations, like, with pip or with conda, but also mentions the Thonny plug-in
  • I've been pointing students to a page I made, based on @tabreturn instructions, that now has EN, PT and ES versions...
    • It now (for the last several months I guess) recommends installing py5 via Thonny before the plug-in
    • Then you install the thonny-py5modeplug-in
    • Then at "first run" the plug-in will install the JDK and set Thonny's env vars with a JAVA_HOME

If you haven't yet, could you please test these later versions? Or in case you did that, could you try not installing py5 beforehand to see what happens?

from thonny-py5mode.

villares avatar villares commented on August 26, 2024

@hx2A, if you have the time, please check what happens if you install py5 (from the Thonny manage packages dialog) before the plug-in. Beware Thonny might be leaving behind a "sites-packages" somewhere in your user folder.

from thonny-py5mode.

hx2A avatar hx2A commented on August 26, 2024

@hx2A, if you have the time, please check what happens if you install py5 (from the Thonny manage packages dialog) before the plug-in. Beware Thonny might be leaving behind a "sites-packages" somewhere in your user folder.

Sure, I can do that. How do I get to a clean slate? Should I uninstall Thonny first? Is there another folder I must get rid of?

from thonny-py5mode.

villares avatar villares commented on August 26, 2024

Good question... There is no central "uninstall" on MacOS, I think, and on Windows I know it leaves behind things at <username>\AppData\Roaming\Python\Python310\site-packages... so maybe you could try searching, I'm not sure 😕

from thonny-py5mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.