1

There is of course JPython, that allows to run Python within JVM.

But will it do to run Python that have some or many dependencies/libraries like pandas, requests ?

Is there guaranteed way to run any Python script on JVM?


P.S. within the same process, so that memory structures can be shared.

P.P.S Jython version is 2.7, compatible with Python 2.x, there is likely no Python 3.6+ support.

The most recent release is Jython 2.7.2. It was released on 21 March 2020 and is compatible with Python 2.7

More general question was Calling Python in Java?

GraalVM Python Runtime is experimental, but aims at Python 3.8 and supporting SciPy/NumPy https://www.graalvm.org/reference-manual/python/

GraalVM provides a Python 3.8 compliant runtime. A primary goal of the GraalVM Python runtime is to support SciPy and its constituent libraries, as well as to work with other data science and machine learning libraries from the rich Python ecosystem. At this point, the Python runtime is made available for experimentation and curious end-users.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332

1 Answers1

1

Last answer from https://stackoverflow.com/a/62082797/482717 gives full options list

https://talvi.net/a-brief-overview-of-python-java-bridges-in-2020.html -> https://github.com/pont-us/python-java-bridge-demos

As GraalVM is the latest effort, it is unlikely any older project succeeded in supporting SciPy/NumPy/pandas

A brief overview of Python-Java bridges in 2020:

  1. GraalVM

Website: https://www.graalvm.org/
Documentation: https://www.graalvm.org/docs/
Source: https://github.com/oracle/graal
Initial release: 2019

  1. Javabridge

Website: https://github.com/LeeKamentsky/python-javabridge
Documentation: https://pythonhosted.org/javabridge/
Source: https://github.com/LeeKamentsky/python-javabridge
PyPI: https://pypi.org/project/javabridge/
Initial release: 2014

  1. jep

Website: https://github.com/ninia/jep
Documentation: https://github.com/ninia/jep/wiki
Source: https://github.com/ninia/jep
PyPI: https://pypi.org/project/jep/
Initial release: 2015

  1. jpy

Website: https://github.com/bcdev/jpy/
Documentation: https://jpy.readthedocs.io/en/latest/
Source: https://github.com/bcdev/jpy
PyPI: https://pypi.org/project/jpy/
Initial release: 2014

  1. JPype

Website: https://github.com/jpype-project/jpype/
Documentation: https://jpype.readthedocs.io/en/latest/
Source: https://github.com/jpype-project/jpype/
PyPI: https://pypi.org/project/JPype1/
Initial release: 2005

  1. Jython

Website: https://www.jython.org/
Documentation: https://www.jython.org/
Source: https://github.com/jythontools/jython
Releases announced on: http://fwierzbicki.blogspot.com/
Initial release: 1997 (as JPython)

  1. Py4j

Website: https://www.py4j.org/
Documentation: https://www.py4j.org/contents.html
Source: https://github.com/bartdag/py4j
PyPI: https://pypi.org/project/py4j/
Initial release: 2009

  1. PyJNIus

Website: https://github.com/kivy/pyjnius
Documentation: https://pyjnius.readthedocs.io/en/stable/
Source: https://github.com/kivy/pyjnius
PyPI: https://pypi.org/project/pyjnius/
Initial release: 2012

See also

Paul Verest
  • 60,022
  • 51
  • 208
  • 332