How to install GraalVM with Python?

259 Views Asked by At

I wanted to test the GraalVM project. I firstly installed graalvm-jdk-21.0.1+12.1; however, in the step where I had to run the command '"${JAVA_HOME}"/bin/gu install python', I run into trouble. There was no /bin/gu file inside the "graalvm-jdk-21.0.1+12.1" directory.

I then installed graalvm-jdk-17.0.9+11.1 which contained /bin/gu file. But this time I run into another issue which was: Python not available

I tried to skip this step and run "mvn compile" and it gave the error below: `

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.623 s
[INFO] Finished at: 2023-10-18T15:08:57+04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-graalvm-python) on project PygalExample: org.apache.maven.plugins.enforcer.RequireFilesExist failed with message:
[ERROR] You must set JAVA_HOME to a GraalVM with Python installed.
[ERROR] Some required files are missing:
[ERROR] /home/eshqin/Downloads/graalvm-jdk-17_linux-x64_bin/graalvm-jdk-17.0.9+11.1/bin/graalpython
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How can I solve this issue and replicate the test? When I run "mvn clean install" it also fails.

My operating system is Ubuntu 20.04

I would like this project to be compiled and run successfully.

1

There are 1 best solutions below

0
On BEST ANSWER

The latest release of GraalVM (GraalVM for JDK21) changes how languages are deployed. There is no gu (Graal Updater) and GraalPy is not installed into the GraalVM installation, but instead it is published on Mavencentral. The pom.xml script in the article assumes older version of GraalVM. We will update the article.

For the time being, this is a new article about the changes:

https://medium.com/graalvm/truffle-unchained-13887b77b62c

you'd have to modify pom.xml from the old GraalPy article accordingly. Another alternative is to use the new GraalPy's standalone tool to generate a skeleton of Java app:

https://www.graalvm.org/latest/reference-manual/python/standalone-binaries/#embedding-graalpy-in-a-java-application