Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Do we have Python library support in voc like Numpy? #975

Open
kishcs opened this issue Sep 3, 2019 · 2 comments
Open

Do we have Python library support in voc like Numpy? #975

kishcs opened this issue Sep 3, 2019 · 2 comments

Comments

@kishcs
Copy link

kishcs commented Sep 3, 2019

Hi,

I was trying to compile and build python code with Numpy library, but I get error.
So I would like to know the scope of current VOC and what libraries it supports.

my code:
from java.lang import System
import numpy as np

print("JRE version:", System.getProperty('java.version'))
print("JAVA from:", System.getProperty('java.vendor'))
print("Current Classpath:", System.getProperty('java.class.path'))
ver = np.version.version
print("Numpy version:", ver)
print("Numpy version:", np.version.version)

I get error like:

JRE version: 12.0.2
JAVA from: Oracle Corporation
Current Classpath: ../dist/Python-3.7-Java-support.b7.jar;.
Exception in thread "main" NameError: name 'version' is not defined
        at org.python.java.Module.__getattribute__(Module.java:33)
        at python.javainfo.module$import(javainfo.py:7)
        at python.javainfo.main(javainfo.py)

Please put some light on it. Thanks.

@freakboy3742
Copy link
Member

Not at present, for three reasons.

Firstly, there are some Python constructs that VOC doesn't currently support. Numpy is fairly sophisticated Python code, and exercises lots of these constructs. We need to fix the bugs and omissions in the VOC compiler

Secondly, very little of the Python standard library has been ported. Numpy uses plenty of the standard library, so we need to port those pieces (and in particular, the pieces written in C) to VOC.

Third, Numpy makes extensive use of C modules - which, as you might predict, don't work great in a Java ecosystem :-) It might be possible to provide a JNI implementation of the CPython C API, but that's something we haven't begun to look at.

So - for now at least, supporting Numpy isn't something that unfortunately is not possible. That might change over time - but it will require a significant investment of time and effort.

@kishcs
Copy link
Author

kishcs commented Sep 5, 2019

@freakboy3742

Thanks for your reply and elaborate explanation.
I understood it and definitely it requires significant amount of time & effort for this development.

Thank You.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants