Closed claudefalbriard closed 4 months ago
This is where the jdk-install
module is used:
https://github.com/tabreturn/thonny-py5mode/blob/main/thonnycontrib/thonny-py5mode/install_jdk.py
Reading its documentation it should detect architecture:
@claudefalbriard, can you try:
import jdk
print(jdk.OS) # Detected platform operating system
print(jdk.ARCH) # Detected platform CPU architecture
To see if it is detecting the aarch64
correctly?
Here you find the debugs from the console of the Ubuntu as well as the output generated by the Python jdk packet. Its results shows that it picks a wrong architecture code for my Raspberry hardware.
(base) claude@claude-raspberry:~$ uname -m
aarch64
import jdk
print(jdk.OS)
print(jdk.ARCH)
output is: linux x64
The error seems to be located at the package: python "jdk". The "install-jdk" package doesn't mention other architectures like: Raspberry aarch64. The web page says: "Currently supports 32-bit and 64-bit versions of Windows, Linux, and macOS"
Cool, let's see how we can improve that.
Can we hack our own version of jdk-install?
Then perhaps we could offer a PR upstream...
This is where the magic should happen... https://github.com/jyksnw/install-jdk/blob/master/jdk/__init__.py
from sys import platform, maxsize
from os import path
_IS_WINDOWS = os.name == "nt"
_IS_DARWIN = platform == "darwin"
_UNPACK200 = "unpack200.exe" if _IS_WINDOWS else "unpack200"
_UNPACK200_ARGS = '-r -v -l ""' if _IS_WINDOWS else ""
_USER_DIR = path.expanduser("~")
_JRE_DIR = path.join(_USER_DIR, ".jre")
_JDK_DIR = path.join(_USER_DIR, ".jdk")
OS = "windows" if _IS_WINDOWS else "mac" if _IS_DARWIN else platform
ARCH = "x64" if maxsize > 2 ** 32 else "x32"
According to this: https://raspberrypi.stackexchange.com/a/117313/3089
platform.machine()
will return:
armv7l
on Raspberry Pi running on Raspbian 32-bit.aarch64
on all Arm 64-bit OSes, including those running in Amazon AWS Graviton2.
[UPDATE] I can't find how to call platform.machine()
!!!
[UPDATE 2]:
import os
print(os.uname().machine)
Hi, I am the creator and maintainer of install-JDK. First, I apologize that I didn't get to this issue sooner. I had no clue that the project became popular and was being used in many places. I had created it as a one-off script for something I needed at work one day. With that said, I plan to give attention to the project over the coming weeks and months to see how I can better support the adopted community. The first two items I plan to tackle are moving to the Adoptium API next up and adding support for other architectures.
Hi, I am the creator and maintainer of install-JDK. First, I apologize that I didn't get to this issue sooner. I had no clue that the project became popular and was being used in many places. I had created it as a one-off script for something I needed at work one day. With that said, I plan to give attention to the project over the coming weeks and months to see how I can better support the adopted community. The first two items I plan to tackle are moving to the Adoptium API next up and adding support for other architectures.
Wonderful news @jyksnw! We will try to help you with the limited knowledge we have, probably testing. Thank you so much for your work.
Cheers @MarcScott check this good news... and maybe you'll be able to help too :wink:
@claudefalbriard, I think we can close this now. If you find any problems, we can re-open it!
Using the Thonny plugin by calling "thonny-py5mode" I've got into an issue related to the architecture choice for the JDK-17 package. My test environment is a Raspberry Pi-3B using architecture aarch64. The JDK, which was automatically installed by the plugin, was incompatible. As a temporary fix, I've manually downloaded an OpenJDK 17 and fixed the PATH via bash and corrected the JAVA_HOME variable inside the Thonny settings. This fix works OK. Please analyze the automatic install routine of the plugin in order to download a hardware compatible JDK runtime.