Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In my case, there is a True returned for

sage: from sage.interfaces.jmoldata import JmolData
sage: jdata = JmolData()
sage: jdata.is_jvm_available()
True

For this to work, the subprocess call (try jdata.is_jvm_available?? to see the problem line of code) has to find java. For me, this also works, it is a cheap linux machine running Manjaro, where i never have to take care about paths:

sage: import subprocess
sage: print subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)
....: 
openjdk version "1.8.0_144"
OpenJDK Runtime Environment (build 1.8.0_144-b01)
OpenJDK Server VM (build 25.144-b01, mixed mode)

To fix the problem, one solution would be to make subprocess find the java (version). Try this from the sage interpreter console and/or from some other (iron) python console or IDE. It is rather a mixture of an operating system problem and a java installation & system wide recognition problem, than a sage problem from my point of view.

An other solution would be to use explicitly an other viewer in:

sage: var( 'x,y' );
sage: p = plot3d( x^2 + y^2, (x,-2,2), (y,-2,2) )
sage: p.show( viewer='canvas3d' )    # or 'tachyon' instead

Try p.show? in the command line to see potential viewers. (The chosen one has to be installed and working (also in sage).)

The viewer tachyon will possibly become the new default viewer...

Note: Not in this answer, but somehow in the same issue: During my experience with (plot and) plot3d there were often problems to save a file from the "picture seen in a (jmol) window". Also trying p.save may be frustrating when it saves a black image with a jmol signature in the lower right corner. When tachyon shows some picture (of a plot3d) with a spartan window making the user ask herself / himself "where is my pic?!", then the menu lets us open it with some other viewer, e.g. okular or jmol. Well, jmol opens an interstellar black solid filled rectangle. (Okular does better.) And when opening it via p.show() using the (in my case) working jmol, then there is hard to find the location of the file shown, and there is no menu to save "it" in e.g. ~/temp . The story came at some days, as i was concerned with plotting elliptic curves (to put them in some latex document). My solution was to abandon plotting elliptic curves and to concentrate on maths. Sage makes a wonderful job in this field, and we need more questions and more answers on issues regarding structural mathematics, e.g. elliptic curves.

Note: All this experience is a good one, some day i will understand git and the sage code commit in it, improve the situation e.g. by adding an option verbose=False, which in case of p.show( verbose=True ) should deliver all relevant information about hidden files and applications used to save them and started sub-processes.