Goal: To be able to execute python scripts from Java. Python Scripts include the use of python data science package like numpy, scipy, pandas.
Experiment 1: Jython with PythonInterpreter
Pros:
- Can run single-single python statement or python script
- Objects inside python can be excessed from java
Cons:
- Because it work on top of Jython distribution of python, Third party package(i.e. pandas, pymongo) based on Cpython might not be available
- JyNI project helps to add some third party Cpython type packages but it is in initial stage and import Data Science package like “Numpy”, “Panda” not supported.
Experiment 2: Jython with ScriptEngine
Skipping this part for now. It is very similar to “PythonInterpreter” approach and core problem still of supporting Cpython packages is still there.
Experiment 3: Java Embedded Python (Initial Experiment Successful)
Pros:
- Can work on default python packages
- Python Script processing
- Objects inside python can be excessed from java
- Third Party Cpython type package support
Cons:
- Complicated setup
Summary:
Jython:
Jython based solution might not work because java based python compiler does not support Cpython based packages like Pandas, Numpy etc. The best effort made to make Jython compatible with Cpython based package is via project “JyNi”. But Jyni also does not support Numpy or panda as of now.
JEP:
JEP is the best option for our use case so far. It works with Cpython interpreter which we use by default. It allow us to use all the packages/libraries supported by regular Cpython. Though it is tested successfully for importing packages like “pandas” and “nltk”, more test are required to check its boundary of compatibility.
Hello Nishant,
ReplyDeleteThe Article on Execute python data science packages from Java is very informative give detail information about it. Thanks for Sharing the information about Data Science. data science consulting
Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
ReplyDeleteDigital Marketing Training in Chennai
Digital Marketing Course in Chennai
Sign up today for the intensive Python Course in Hyderabad program taught by experienced trainers from AI Patasala.
ReplyDeleteOnline Python Course in Hyderabad
I just wanted to comment in this blog to support you. Nice blog and informative content. Keep sharing more blogs with us. All the best for your future blogs.
ReplyDeleteData Science Course Training in Hyderabad