Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup numpy in jython

There is a project called JyNI that allows you to run NumPy in Jython. However I haven't come across anywhere on how to get NumPy into Jython. I've tried 'pip install numpy' (which will work for normal python 3.4.3) but gives an error about a missing py3k module. Does anybody have a bit more information about this?

like image 532
user1584120 Avatar asked May 13 '15 12:05

user1584120


1 Answers

JyNI does state NumPy-support as its main goal, but cannot do it yet, as long as it is still in alpha-state. However until it is mature enough you can use NumPy via

  • JEP (https://github.com/mrj0/jep) or
  • JPY (https://github.com/bcdev/jpy).

Alternatively you can use a Java numerical library for your computation, e.g. one of these:

  • https://github.com/mikiobraun/jblas
  • https://github.com/fommil/matrix-toolkits-java

Both are Java-libs that do numerical processing natively backed by blas or lapack (i.e. the same backends NumPy uses), so the performance should equal that of NumPy more or less. However they don't feature such a nice multiarray implementation as NumPy does afaik.

If you need NumPy indirectly to fulfill dependencies of some other framework, these solutions won't do it out of the box. If the dependencies are only marginal you can maybe rewrite/substitute the corresponding calls based on one of the named projects. Otherwise you'll have to wait for JyNI...

If you can make some framework running on Jython this way, please consider to make your work publicly available, ideally as a fork of the framework.

like image 100
stewori Avatar answered Sep 20 '22 09:09

stewori