#14071: In Sage notebook, R graphics capabilities depend on the *current* 
running
environment
--------------------------------------+-------------------------------------
       Reporter:  charpent            |         Owner:  tbd     
           Type:  defect              |        Status:  new     
       Priority:  minor               |     Milestone:  sage-5.7
      Component:  packages            |    Resolution:          
       Keywords:  r-project graphics  |   Work issues:          
Report Upstream:  N/A                 |     Reviewers:          
        Authors:  charpent            |     Merged in:          
   Dependencies:                      |      Stopgaps:          
--------------------------------------+-------------------------------------

Comment (by charpent):

 This is mostly a clarification/edition of
 https://groups.google.com/forum/#!topic/sage-support/_92LFEm9uBs .

 I have had problems getting '''reliably''' R graphics from the Sage
 notebook.[[BR]][[BR]]Getting R graphics from a Sage notebook cell works
 with no (reproductible) problems from a server launched by "sage -n" from
 an X11 terminal. The problems start when I try to use a pre-launched
 server, whether from the same machine or from another machine through a
 ssh port redirection. To make a long story short, I have been able to
 reduce the problem to the following test case :[[BR]][[BR]]Let S be a
 server and L an laptop client. Both are runing Debian (mostly) wheezy. The
 server has a 5.6 installation of Sage (with
 [http://trac.sagemath.org/sage_trac/ticket/14008 trac#14008] installed) in
 the home directory of the "sage" user.[[BR]][[BR]]in L : create a ssh
 redirection from L to S on some suitably chosen port xxxxx :[[BR]]L : ssh
 -f -N -!L:xxxxx:localhost:xxxxx SSS.SSS.SSS.SSS[[BR]][[BR]]login to S from
 L '''with an ssh connection relaying X''' :[[BR]]L$: ssh -Y
 [email protected][[BR]][[BR]]In this terminal, start the sage server
 :[[BR]]sage -n directory=/home/sage/sage_notebooks.sagenb/ port=xxxxx
 automatic_login=False &[[BR]]DO NOT LOGOUT FROM THI SSH SESSION NOW !
 [[BR]][[BR]]in L, start a browser and go to !localhost:xxxxx [[BR]]Log
 in[[BR]]Create a small test worksheet :[[BR]]first cell
 :[[BR]]r('capabilities("png")')[[BR]]you get the R answer :[[BR]]

 {{{
    png
   TRUE
 }}}
 Second cell : an idiotic test
 
:[[BR]]r.png()[[BR]]r.plot(r.rnorm(1000,0,1),r.rnorm(1000,0,1),xlab='X',ylab="Y")[[BR]]you
 get first the answer to r.png :[[BR]]

 {{{
   null device
             1
 }}}
 then a graph [ Not reproduced here, see original post).

 This is OUTPUT 1 from now on.[[BR]][[BR]]Then, go back to your terminal
 and disconnect your ssh session from S.[[BR]]Go back to tour worksheet,
 and use the "action" menu to 1) Restart the worksheet and 2) Evaluate
 all.[[BR]]The first cell now gives :[[BR]]

 || || `[[BR]]  png[[BR]]FALSE[[BR]]` ||

 And the second (after expansion) :[[BR]]       {{{ Traceback (most recent
 call last):

   File "<stdin>", line 1, in <module> File "_sage_input_3.py", line 10, in
 <module>
     exec compile(u'open("__ _code__ _.py","w").write("# -*- coding: utf-8
 -*-\\n" +
 
_support_.preparse_worksheet_cell(base64.b64decode("ci5wbmcoKQpyLnBsb3Qoci5ybm9ybSgxMDAwLDAsMSksci5ybm9ybSgxMDAwLDAsMSkseGxhYj0nWCcseWxhYj0iWSIp"),globals())+"\\n");
 execfile(os.path.abspath("__ _code__ _.py"))
   File "", line 1, in <module>

   File "/tmp/tmpFygLc1/__ _code__ _.py", line 3, in <module>
     r.png()
   File "/home/sage/sage-5.6/local/lib/python2.7/site-
 packages/sage/interfaces/r.py", line 364, in png
     raise RuntimeError , "R was not compiled with PNG support"

 RuntimeError: R was not compiled with PNG support }}} [[BR]]This is OUTPUT
 2 from now on.[[BR]][[BR]]Now, go back to your terminal and reconect to S
 '''without X relay''' :[[BR]]L$: ssh [email protected][[BR]][[BR]]Going
 back to the browser, restart the worksheet and evaluate all cells. You get
 OUTPUT TWO (modulo the points of the graph, of course).[[BR]][[BR]]In the
 terminal : logout from S then reconnect to it '''with X relay'''. In the
 browser, restart the worksheet and evaluate all cells : you get OUTPUT 1
 again.[[BR]] [[BR]]!!!!! [[BR]][[BR]]The converse experiment (start the
 server in a non-X-relayed terminal, then connect with X relay) does not
 work : in all cases, you get OUTPUT 2.[[BR]][[BR]]I also tried to start my
 port redirection with X relay, to no avail. : you get OUTPUT
 2...[[BR]][[BR]]Former experiments (not formalized yet) let me think that
 you get OUTPUT 1 as long as the sage user has a connexion to an X server :
 my first tries were from a VNC server with a terminal where I sudo'd to
 the sage user to start the server and left it open. More on this after
 more formal experiment.[[BR]][[BR]]From this brief trial, I conclude that
 the Sage server must be started in an environment where X is accessible
 '''AND''' must have some access to X to be able to produce png
 graphs.[[BR]][[BR]]A couple more data points : when running "sage -R" from
 an X-enabled ssh connection :[[BR]]> capabilities()[[BR]]    jpeg      png
 tiff    tcltk      X11     aqua http/ftp  sockets [[BR]]    TRUE     TRUE
 FALSE     TRUE     TRUE    FALSE     TRUE     TRUE [[BR]]  libxml     fifo
 cledit    iconv      NLS  profmem    cairo [[BR]]    TRUE     TRUE
 TRUE     TRUE     TRUE    FALSE    FALSE [[BR]][[BR]]whereas "native R"
 (as packaged by Dirk Ettelbuettel for Debian unstable) :[[BR]]>
 capabilities()[[BR]]    jpeg      png     tiff    tcltk      X11     aqua
 http/ftp  sockets [[BR]]    TRUE     TRUE     TRUE     TRUE     TRUE
 FALSE     TRUE     TRUE [[BR]]  libxml     fifo   cledit    iconv      NLS
 profmem    cairo [[BR]]    TRUE     TRUE     TRUE     TRUE     TRUE
 TRUE     TRUE [[BR]][[BR]][[BR]]When running "sage -R" from a X-disabled
 ssh connection :[[BR]]> capabilities()[[BR]]    jpeg      png     tiff
 tcltk      X11     aqua http/ftp  sockets [[BR]]   FALSE    FALSE    FALSE
 TRUE    FALSE    FALSE     TRUE     TRUE [[BR]]  libxml     fifo   cledit
 iconv      NLS  profmem    cairo [[BR]]    TRUE     TRUE     TRUE     TRUE
 TRUE    FALSE    FALSE [[BR]][[BR]] "native R":[[BR]]>
 capabilities()[[BR]]    jpeg      png     tiff    tcltk      X11     aqua
 http/ftp  sockets [[BR]]    TRUE     TRUE     TRUE     TRUE    FALSE
 FALSE     TRUE     TRUE [[BR]]  libxml     fifo   cledit    iconv      NLS
 profmem    cairo [[BR]]    TRUE     TRUE     TRUE     TRUE     TRUE
 TRUE     TRUE [[BR]][[BR]]"Native R" keeps png (and jpeg, tiff, tcltk
 cairo) capabilities when ran without X access... The problem might be at
 least partially on Sage's side...[[BR]][[BR]]I plan to try to find a
 workaround for this problem (maybe starting a VNC server starting the sage
 server, but this sounds a bit ridiculous), then find relevant tickets
 (8868, 11249, 12057 seem relevant, beut some of them are "fixed,
 resolved"...) and start digging (but not right now...).[[BR]][[BR]]The
 original mail ended with the following plea :[[BR]]"I'd like to collect
 your experiences about this problem : When you have experienced the "no
 PNG capability" problem :[[BR]]

  * had your server had access at start time ? ?
  * had you X access at time of use ?
  * had your server X access at time of use ?"

 The original mail got 14 views and no answer.

 I have since been able to reproduce it on a small machine (netbook) and
 Sage 5.5. I since lost this setup (I had to upgrade to 5.6 + patch from
 ticket 14008).

 I am making a ticket of it mostly for archiving purposes. I do nor plan to
 undertake research about it in a short while, due to RealLife(TM)
 constraints. I plan to gp a$back to the R building mechanism as invoked
 from Sage building mechanism.

 Any further information will still be appreciated, especially from Sage R
 maintainers...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14071#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to