[Solved] Can't run py5 sketch : Fatal error detected by the Java Runtime Environment

Hello, I have a problem running the basic example py5 sketch (.py file) with VS code on my Mac with the error message below (also telling me that an error report file was created). I’m sorry in advance if the solution is obvious, but I’m not a dev. I searched far and wide and couldn’t figure it out. Thanks a lot for your kind help! :smiling_face:

I just installed VS code, some extensions, Python, Java JDK 21 (from Oracle website, DMG installer) and Py5 (with pip3 install) when it happened for the first time. I then successively tried different versions of Java. I tried pip3 install install-jdk but it didn’t solve any problem. I also tried to uninstall java, but couldn’t manage to do so.

A fatal error has been detected by the Java Runtime Environment:`
SIGSEGV (0xb) at pc=0x0000000101e68464, pid=1864, tid=259`
JRE version: Java(TM) SE Runtime Environment (17.0+35) (build 17+35-LTS-2724)`
Java VM: Java HotSpot(TM) 64-Bit Server VM (17+35-LTS-2724, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)`
Problematic frame:`
C  [Python+0x290464]  _PyObject_GC_New+0x130

Tested file

The sketch proposed on py5 website:

import py5

def setup():
py5.size(200, 200)
py5.rect_mode(py5.CENTER)

def draw():
py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)

py5.run_sketch()

Specs

  • py5 0.10.4a2
  • Python 3.13.3
  • Java JDK 21.XXX, 24.0.1 and 17 installed in this order (to test if one would work)
  • Visual Studio Code 1.99.3 (Universal), with some extensions (Microsoft’s ones for Python, autopep8…)
  • Mac book pro M3 MacOs Sequoia 15.4.1

More info

Processing software is working fine on my Mac.
JAVA_HOME is currently pointing to Java 17.
java --versiongives me:

java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

where java gives me:

/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java
/usr/bin/java
/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java

I don’t know enough about py5 yet to really help you but I can tell you that Processing itself is designed to run on the Temurin JDK: https://adoptium.net/en-GB/temurin/releases

I think you’re running it on the Oracle JDK which I’ve seen documents about being not supported.

Hope that helps!

1 Like

Thanks a lot for your remark @stefterv! :folded_hands: I installed Temurin JDK and changed my JAVA_HOME to point to it. Sadly it still doesn’t work… Seemed really promising tho, since py5 documentation is briefly mentioning OpenJDK. And they propose to use the install-jdk package which use it also. I didn’t know there is a difference between those java versions.

The same error:

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x0000000106370464, pid=4182, tid=259

JRE version: OpenJDK Runtime Environment Temurin-21.0.7+6 (21.0.7+6) (build 21.0.7+6-LTS)
Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (21.0.7+6-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
Problematic frame:
C  [Python+0x290464]  _PyObject_GC_New+0x130

More info

I have those versions installed (printed when running /usr/libexec/java_home -V ):

Matching Java Virtual Machines (4):
    24.0.1 (arm64) "Oracle Corporation" - "Java SE 24.0.1" /Library/Java/JavaVirtualMachines/jdk-24.jdk/Contents/Home
    21.0.7 (arm64) "Eclipse Adoptium" - "OpenJDK 21.0.7" /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
    21.0.7 (arm64) "Oracle Corporation" - "Java SE 21.0.7" /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
    17 (arm64) "Oracle Corporation" - "Java SE 17" /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-24.jdk/Contents/Home

Idk if this could be of any help to solve the problem, but here is my current .zshrc file:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

And java --version:

openjdk 21.0.7 2025-04-15 LTS
OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)

Not on MacOS, but on Garuda Linux. But maybe these links might help you somehow: :folded_hands:

1 Like

Solution :tada:

Upgrading JPype1 package from 1.5 to 1.5.2 against py5 requirements might be the solution as it worked for me. However I’ll detail here all the steps that I took. Thanks @GoToLoop for the useful links! Thanks @stefterv for your previous input!

Previous steps

  1. Install Java OpenJDK (used by Processing) and not Oracle’s one.
    You can see your installed versions with the finder. Maintain the option key to reveal bread crumbs at the bottom. Select Macintosh HD > Library > Java > JavaVirtualMachine.
    In your terminal:
$ # Modify the last command to erase all versions that you might have in your folder
$ cd /Library/Java/JavaVirtualMachines
$ sudo rm -rf jdk-21.jdk

Then download Eclipse Temurin on Adoptium’s website (I used the pkg installer)

  1. Set up JAVA_HOME and path. In your terminal write open ~/.zshrc. In the text file add:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

Save, close the text editor. In the terminal type $ source ~/.zshrc to apply the changes. If you write in your terminal echo $JAVA_HOME you should now see the path. And java --version will tell your which version is chosen and used.

JPype1 1.5.2 installation

Apparently this upgrade solved the problem in this post and this is what most likely solved mine.

  1. Force the upgrade of JPype1 with pip3 install --upgrade --force-reinstall JPype1. The first time I encountered this SSL Certificate error:
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(5, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)'))) - skipping
  1. Install the certificates. Within the Finder, open the Application folder, then Python folder and double click on Install Certificates.command file to install them (as they are apparently not installed automatically when installing python via the pkg installer).
  2. Run again the command pip3 install --upgrade --force-reinstall JPype1.
    You’ll probably get this, as I got:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
py5 0.10.4a2 requires jpype1==1.5.0, but you have jpype1 1.5.2 which is incompatible.
Successfully installed JPype1-1.5.2 packaging-25.0
  1. Verify that you have jpype1==1.5.2 by running pip3 freeze.
  2. Try to run your py5 sketch again and it should work.
2 Likes