[Numpy-discussion] installing numpy in jython (in Netbeans)

Chris Barker chris.barker at noaa.gov
Sun Aug 26 20:55:39 EDT 2012


Todd,

The short version is: you can't do that. -- Jython uses the JVM, numpy
is very, very tied into the CPython runtime.

This thread is a bit old, but think still holds:

http://stackoverflow.com/questions/3097466/using-numpy-and-cpython-with-jython

There is the junumeric project, but it doesn't look very active:

https://bitbucket.org/zornslemon/jnumeric-ra/downloads/

According to the Jython FAQ
(http://wiki.python.org/jython/JythonFaq/GeneralInfo):
"For the next release of Jython, we plan to support the C Python
Extension API" -- not sure what the timing is on that, but in theory,
you could then use numpy ,but numpy is a pretty complex beast -- I
wouldn't recommend being the first to try it!

So: other options:

1) A couple years ago the NetBeans team was talking about improving
the support for Python (CPython) -- you might want to see if there is
a plugin or something that you could add. Maybe this:
http://wiki.netbeans.org/Python

2) Python programming can be pretty darn productive with "print"
debugging -- a lot of us never use a "proper" debugger -- a good
programmers editor and a console is all you need.

3) There are a lot of good IDEs for CPython -- and stad-alone
debuggers (WinPdb, for example), so you don't need to be married to
the NetBeans environment.

In short: It'll probably be a lot easier to find a different
programming (or debugging anyway) )environment than get numpy to work
work with Jython.

-Chris





On Sun, Aug 26, 2012 at 4:36 PM, Todd Brunhoff <toddb at nvr.com> wrote:
> Being a newbie to this list, I recognize that the answer to this might be
> "why would you do that?". But surely it can't be worse than that.
>
> Briefly put, I want to install numpy and scipy in jython (reasons below).
> Running 'cd <jython distro>; jython setup.py install' runs into errors. But
> installing he same distro under python works fine. So the underlying
> question is: is there a way to install numpy under jython?
>
> Here's how I got here. The reason I would like this under jython is wrapped
> up in Netbeans, Octave, Matlab and Windows 7. I've been using Netbeans under
> linux for years for c++ and a bit of Java, and the editing environment with
> cross referencing and syntax-directed editing is quite good. Netbeans only
> presents python debugging via jython, which makes sense. Most of the work I
> am doing is with matrix algebra and I started with Octave, but while Octave
> is excellent for operating on matrices, it is not good for file format
> manipulations, hence for some operations I'd like to turn to python, and if
> I edit under Netbeans, the debugging requires that I install numpy under
> jython. At work I use a machine running fedora 16 .... but... I travel a bit
> and my travel machine is a laptop running windows 7. Therefore, Windows 7 +
> Netbeans + numpy + debugging ==> jython + numpy + scipy.
>
> Here's the install problems, which occur under numpy-1.7.0b1 and 1.6.2. The
> first install error is in numpy\distutils\exec_command.py, line 585, where
> it throws an exception because the java exec tests are unlimited. So I
> comment out those two lines, and rerun the setup.py.
>
> The next errors are notes about features not being available because other
> packages are also unavailable.  I don't think this is really getting in the
> way, although I could be wrong.  The libraries mentioned as missing are:
>
> libraries mkl,vml,guide
> libraries ptf77blas,ptcblas,atlas
> libraries lapack_atlas
>
> So setup gets as far as this:
>
> running install
> running build
> running config_cc
> unifing config_cc, config, build_clib, build_ext, build commands --compiler
> options
> running config_fc
> unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
> options
> running build_src
> build_src
> building py_modules sources
> creating build
> creating build\src.java1.6.0_33-2.5
> creating build\src.java1.6.0_33-2.5\numpy
> creating build\src.java1.6.0_33-2.5\numpy\distutils
> building library "npymath" sources
> No module named jythoncompiler in numpy.distutils; trying from distutils
> customize GnuFCompiler
> Could not locate executable g77
> Could not locate executable f77
> don't know how to compile Fortran code on platform 'java'
>
> Some of these messages make it look as if the config wants to use the cygwin
> gnu compilers, which are ok, but under windows are not nearly as good as
> mingw gnu compiler or better yet, the visual studio 2010 compiler. I have
> both, but I don't see a way to steer the numpy setup to use them.
>
> The next error is fatal
>
> File "...\numpy-1.7.0b1\numpy\distutils\ccompiler.py", line 111, in
> CCompiler_object_filenames
>     if ext not in self.src_extensions:
> TypeError: 'NoneType' object is not iterable
>
> This one looks as if it does not know what .o or .a or .obj files are.
> Fixing this one looks like hours of digging through the code. Is there a
> simpler solution?
>
> Thanks in advance,
>
> Todd
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list