at the moment I am re-evaluating a few papers in Python. As a few papers used Weka classifiers, I opted to use the convenient Python wrapper.
The requirements and scenarios vary a bit, so I would e.g. use larger heaps for one paper, other options like package support for others and change the JVM startup parameters.
DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Classpath=['/home/user/.local/lib/python3.8/site-packages/javabridge/jars/rhino-1.7R4.jar', '/home/user/.local/lib/python3.8/site-packages/javabridge/jars/runnablequeue.jar', '/home/user/.local/lib/python3.8/site-packages/javabridge/jars/cpython.jar', '/home/user/.local/lib/python3.8/site-packages/weka/lib/weka.jar', '/home/user/.local/lib/python3.8/site-packages/weka/lib/python-weka-wrapper.jar', '/home/user/.local/lib/python3.8/site-packages/weka/lib/weka.jar', '/home/user/.local/lib/python3.8/site-packages/weka/lib/python-weka-wrapper.jar']
DEBUG:weka.core.jvm:MaxHeapSize=default
DEBUG:weka.core.jvm:Package support disabled
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/javabridge/jutil.py", line 286, in start_thread
env = vm.create(args)
File "_javabridge.pyx", line 654, in _javabridge.JB_VM.create
RuntimeError: Failed to create Java VM. Return code = -1
ERROR:javabridge.jutil:Failed to create Java VM
Traceback (most recent call last):
File "/home/user/example/test.py", line 4, in <module>
jvm.start()
File "/home/user/.local/lib/python3.8/site-packages/weka/core/jvm.py", line 129, in start
javabridge.start_vm(args=args, run_headless=True, max_heap_size=max_heap_size)
File "/home/user/.local/lib/python3.8/site-packages/javabridge/jutil.py", line 319, in start_vm
raise RuntimeError("Failed to start Java VM")
RuntimeError: Failed to start Java VM
Process finished with exit code 1
I would like to know: Is it a problem with my installation? Or an asynchronous shutdown of the JVM in the background? Or a problem with the javabridge Package? Or some kind of another problem?
A workaround on my side is simply reusing the same JVM for all evaluations, or splitting the executions across multiple Python Executions. However, stopping and restarting within Python would be really convenient. :)
Thanks in advance for any hints. It is not a necessary functionality for me, but the jvm.stop() method did not work as I expected it to work.