#1128859 vtk9: WrappingPythonCore does not link to libpython

Package:
vtk9
Source:
vtk9
Description:
Binaries for VTK9
Submitter:
Drew Parsons
Date:
2026-02-23 19:07:02 UTC
Severity:
normal
#1128859#5
Date:
2026-02-23 19:06:15 UTC
From:
To:
Bug#1125167 has revealed an irregularity linking VTK python modules to python.
The Rendering::Matplotlib uses python (as matplotlib) via the
Wrapping::PythonCore module.

Accessing within python, Rendering::Matplotlib  loads fine
(vtkmodules.vtkRenderingMatplotlib imports successfully in python)

But loading VTK in java, libvtkRenderingMatplotlibJava cannot be loaded.

For instance VTK provides a sample java program, CylinderExample.java
at https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample/
https://gitlab.kitware.com/vtk/vtk-examples/-/blob/master/src/Java/GeometricObjects/CylinderExample.java

Running from java gets an error via the vtkRenderingMatplotlib module
because ibvtkWrappingPythonCore is missing a link to libpython

$ LD_LIBRARY_PATH=/usr/lib/jvm/java-21-openjdk-amd64/lib/:/usr/lib/x86_64-linux-gnu/java/vtk-Linux-x86_64/ java -cp "/usr/share/java/vtk9.jar"  CylinderExample.java
java.lang.UnsatisfiedLinkError: /usr/lib/x86_64-linux-gnu/java/vtk-Linux-x86_64/libvtkRenderingMatplotlibJava.so: /usr/lib/x86_64-linux-gnu/java/vtk-Linux-x86_64/../../libvtkWrappingPythonCore3.13-9.5.so.1: undefined symbol: PyExc_ValueError
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:251)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2451)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
	at java.base/java.lang.System.loadLibrary(System.java:2063)
	at vtk.vtkNativeLibrary.LoadLibrary(vtkNativeLibrary.java:255)
	at vtk.vtkNativeLibrary.LoadAllNativeLibraries(vtkNativeLibrary.java:192)
	at CylinderExample.<clinit>(CylinderExample.java:17)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:536)
	at java.base/java.lang.Class.forName(Class.java:515)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:432)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:208)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:135)
vtkRenderingMatplotlibJava not loaded

This java example does work successfully in the sense that the red
cylinder is displayed. But the python error means that java can't load
the matplotlib module compiled for java (vtkRenderingMatplotlibJava).

I imagine Rendering::Matplotlib would generate the same kind of error
from C++, but the triggering example at hand is in java.

Reported upstream,
https://gitlab.kitware.com/vtk/vtk/-/issues/19960