Package: python3-jpype
Version: 1.4.0-2
Severity: normal
Due to how the org.jpype.jar is packaged (https://salsa.debian.org/python-team/packages/python-jpype/-/commit/44a8befe0b856609a4095f5d9e3979752e367ad8), jpype.startJVM() doesn't work out of the box as documented in upstream documentation:
$ python3 -c 'import jpype; jpype.startJVM()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/jpype/_core.py", line 218, in startJVM
_jpype.startup(jvmpath, tuple(args),
SystemError: java.lang.ClassNotFoundException: org.jpype.classloader.DynamicClassLoader
This is because it's expected to be in /usr/lib/python3/dist-packages/org.jpype.jar (https://github.com/jpype-project/jpype/blob/24a2b95aefc2a59e7cf2c362a92ee5c6b13eb94f/native/common/jp_classloader.cpp#L74) and Debian unfortunately only moves the jar, but doesn't patch jpype to look for it in the new location.
As a workaround, one can explicitly add the jar to classpath:
$ python3 -c 'import jpype; jpype.startJVM(classpath=["/usr/share/java/org.jpype.jar"])'
Unfortunately, this isn't documented anywhere.
-- System Information:
Debian Release: bookworm/sid
APT prefers stable-security
APT policy: (990, 'stable-security'), (990, 'testing'), (500,
'unstable-debug'), (500, 'testing-debug'), (500, 'stable-debug'), (500,
'unstable'), (500, 'stable'), (1, 'experimental-debug'), (1,
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.18.0-3-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_CPU_OUT_OF_SPEC, TAINT_USER, TAINT_WARN
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8), LANGUAGE
not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages python3-jpype depends on:
ii default-jre 2:1.11-72
ii default-jre-headless [java6-runtime-headless] 2:1.11-72
ii libc6 2.34-3
ii libgcc-s1 12.1.0-8
ii libstdc++6 12.1.0-8
ii openjdk-11-jre-headless [java6-runtime-headless] 11.0.16+8-1
ii python3 3.10.5-3
ii python3-numpy [python3-numpy-abi9] 1:1.21.5-1+b1
python3-jpype recommends no packages.
python3-jpype suggests no packages.
-- no debconf information
Tomáš "liskin" ("Pivník") Janoušek, https://lisk.in/