Best way to combine Python and Java?

This page summarizes the projects mentioned and recommended in the original post on /r/java

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • jep

    Embed Python in Java

    I’ve successfully used JEP for some time, and actually went “old school” after that because I wrote an equivalent library to work with multiple languages in pretty much the same way (process to process communication), with additionally scripting (JSR 223) support.

  • jpy

    Jpy: a library that runs an interpreter in the JVM. Spare the service start/stop, but: isn't really feasible for more than a single-liner, data translation between Java and Python is cumbersome, and I also encountered runtime segmentation fault errors.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • JPassport

    JPassport

  • Deeplearning4j

    Suite of tools for deploying and training deep learning models using the JVM. Highlights include model import for keras, tensorflow, and onnx/pytorch, a modular and tiny c++ library for running math code and a java based math library on top of the core c++ library. Also includes samediff: a pytorch/tensorflow like library for running deep learning using automatic differentiation.

    Have you considered migrating off of Python to just using JVM ML libraries then? I hear good things about Deeplearning4j, but there's quite a few.

  • javacpp-embedded-python

    With this library, you can embed Python to your Java or Scala project. The main purpose of this library is to use Python libraries from Java or Scala.

    This should allow you to call python from Java: https://github.com/bytedeco/javacpp-embedded-python

  • dbus-java

    Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)

    Java: https://github.com/hypfvieh/dbus-java/

  • onnxruntime-extensions

    onnxruntime-extensions: A specialized pre- and post- processing library for ONNX Runtime

    Image preprocessing I know less about, but tokenization is something I've dealt with a bunch. There are a few options, either push the tokenizer into the ONNX model and use MS's ONNX Runtime extensions (we've used this when working with sentencepiece tokenizers), port the tokenizer entirely to Java (we did this for BERT), or use a sentencepiece or HF tokenizers wrapper directly (e.g. Amazon's DJL did this - HF, sentencepiece).

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • Deep Java Library (DJL)

    An Engine-Agnostic Deep Learning Framework in Java

    Image preprocessing I know less about, but tokenization is something I've dealt with a bunch. There are a few options, either push the tokenizer into the ONNX model and use MS's ONNX Runtime extensions (we've used this when working with sentencepiece tokenizers), port the tokenizer entirely to Java (we did this for BERT), or use a sentencepiece or HF tokenizers wrapper directly (e.g. Amazon's DJL did this - HF, sentencepiece).

  • deephaven-core

    Deephaven Community Core

    Hi - I'm one of the current maintainers of jpy (in support of https://github.com/deephaven/deephaven-core, we use it extensively). Happy to triage any issues you are having with it.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts