Re: Exception during numpy import
Robert Andre <[email protected]>
| Newsgroups | gmane.comp.lang.jython.devel |
|---|---|
| Message-ID | <[email protected]> |
Pradeep,
While not Numpy, the older JNumeric code might be of use to you,
https://bitbucket.org/zornslemon/jnumeric-ra
rob
On 01/29/2015 11:07 AM, Pradeep Badiger wrote:
>
> Thanks Stefan. I will go through JyNI and the links to others that you
> provided.
>
> Thanks,
>
> Pradeep V.B.
>
> *From:*Stefan Richthofer [mailto:[email protected]]
> *Sent:* Thursday, January 29, 2015 11:00 AM
> *To:* Pradeep Badiger
> *Cc:* [email protected]
> *Subject:* Aw: [Jython-dev] Exception during numpy import
>
> Hello Pradeep,
>
> unfortunately Numpy is not supported by Jython, as it is a native
> C-extenstion for CPython, which are not compatible with Jython in general.
>
> However using JyNI (www.jyni.org <http://www.jyni.org>) one can at
> least use basic C-extensions with Jython, currently linux-only. I hope
> to get it working with Numpy
>
> within half a year or so (but actually estimated this time frame one
> year ago^^).
>
> Until then your best bet would be Numpy4J
> (https://github.com/JosephCottam/Numpy4J) which accesses NumPy from
> java by embedding the CPython
>
> interpreter. It does not integrate with Jython, but you can write a
> java class wrappering the numpy-functions you need and then acces this
> class from
>
> Jython.
>
> These Non-Numpy-specific general aproaches to embed CPython in Java
> are also worth a look:
>
> JPY:
>
> http://jpy.readthedocs.org/en/latest/intro.html
>
> Jepp/Jep:
>
> http://jepp.sourceforge.net
>
> https://github.com/mrj0/jep
>
> - Stefan
>
> *Gesendet:* Donnerstag, 29. Januar 2015 um 16:35 Uhr
> *Von:* "Pradeep Badiger" <[email protected]
> <mailto:[email protected]>>
> *An:* "[email protected]
> <mailto:[email protected]>"
> <[email protected]
> <mailto:[email protected]>>
> *Betreff:* [Jython-dev] Exception during numpy import
>
> Hi,
>
> I am trying to import numpy (1.9.1 for python 2.7) package in a jython
> script and this script is executed using jython-standalone (v 2.7-b1)
> APIs.
>
> I have set the path to numpy by setting the properties in
> PythonInterpreter
>
> Properties props = *new*Properties();
>
> props.setProperty("python.path", "C:\\Python27\\Lib\\site-packages");
>
> PythonInterpreter./initialize/(System./getProperties/(), props,
> *new*String[] {""});
>
> I am getting following exception while evaluating the script.
>
> _javax.script.ScriptException_: SyntaxError: 'import *' not allowed
> with 'from .' in C:\Python27\Lib\site-packages\numpy\__init__.py at
> line number 182 at column number 4
>
> at
> org.python.jsr223.PyScriptEngine.scriptException(_PyScriptEngine.java:190_)
>
> at org.python.jsr223.PyScriptEngine.eval(_PyScriptEngine.java:42_)
>
> at org.python.jsr223.PyScriptEngine.eval(_PyScriptEngine.java:31_)
>
> at
> javax.script.AbstractScriptEngine.eval(_AbstractScriptEngine.java:264_)
>
> at
> com.fico.dmip.scriptjs.PythonScriptExecutor.<init>(_PythonScriptExample.java:68_)
>
> at
> com.fico.dmip.scriptjs.PythonScriptExample.main(_PythonScriptExample.java:50_)
>
> Also I tried with jython-standalone-2.7.b3 and it gave me a different
> exception.
>
> console: Failed to install '':
> _java.nio.charset.UnsupportedCharsetException_: cp0.
>
> _javax.script.ScriptException_: ImportError: No module named
> type_check in <script> at line number 3
>
> at
> org.python.jsr223.PyScriptEngine.scriptException(_PyScriptEngine.java:202_)
>
> at org.python.jsr223.PyScriptEngine.eval(_PyScriptEngine.java:42_)
>
> at org.python.jsr223.PyScriptEngine.eval(_PyScriptEngine.java:31_)
>
> at
> javax.script.AbstractScriptEngine.eval(_AbstractScriptEngine.java:264_)
>
> at
> com.fico.dmip.scriptjs.PythonScriptExecutor.<init>(_PythonScriptExample.java:68_)
>
> at
> com.fico.dmip.scriptjs.PythonScriptExample.main(_PythonScriptExample.java:50_)
>
> Can someone help me on which version of numpy is supported with the
> release of jython?
>
> Thanks,
>
> Pradeep V.B.
>
>
> This email and any files transmitted with it are confidential,
> proprietary and intended solely for the individual or entity to whom
> they are addressed. If you have received this email in error please
> delete it immediately.
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media,
> is your hub for all things parallel software development, from weekly
> thought leadership blogs to news, videos, case studies, tutorials and
> more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/_______________________________________________
> Jython-dev mailing list [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/jython-dev
>
>
> This email and any files transmitted with it are confidential,
> proprietary and intended solely for the individual or entity to whom
> they are addressed. If you have received this email in error please
> delete it immediately.
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
>
>
> _______________________________________________
> Jython-dev mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-dev
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/