Sage: Ticket #14071: In Sage notebook, R graphics capabilities depend on the *current* running environment
https://trac.sagemath.org/ticket/14071
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/14071
Trac 1.1.6charpentWed, 06 Feb 2013 19:37:14 GMT
https://trac.sagemath.org/ticket/14071#comment:1
https://trac.sagemath.org/ticket/14071#comment:1
<p>
This is mostly a clarification/edition of <a class="ext-link" href="https://groups.google.com/forum/#!topic/sage-support/_92LFEm9uBs"><span class="icon"></span>https://groups.google.com/forum/#!topic/sage-support/_92LFEm9uBs</a> .
</p>
<p>
I have had problems getting <strong>reliably</strong> 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 <a class="ext-link" href="http://trac.sagemath.org/sage_trac/ticket/14008"><span class="icon"></span>trac#14008</a> 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 <strong>with an ssh connection relaying X</strong> :<br />L$: ssh -Y sage@…<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 />
</p>
<pre class="wiki"> png
TRUE
</pre><p>
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 />
</p>
<pre class="wiki"> null device
1
</pre><p>
then a graph [ Not reproduced here, see original post).
</p>
<p>
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 />
</p>
<table class="wiki">
<tr><td> </td><td> <code>[[BR]] png[[BR]]FALSE[[BR]]</code>
</td></tr></table>
<p>
And the second (after expansion) :<br /> {{{ Traceback (most recent call last):
</p>
<blockquote>
<p>
File "<stdin>", line 1, in <module> File "_sage_input_3.py", line 10, in <module>
</p>
<blockquote>
<p>
exec compile(u'open("<span class="underline"> _code</span> _.py","w").write("# -*- coding: utf-8 -*-<br />n" + _support_.preparse_worksheet_cell(base64.b64decode("ci5wbmcoKQpyLnBsb3Qoci5ybm9ybSgxMDAwLDAsMSksci5ybm9ybSgxMDAwLDAsMSkseGxhYj0nWCcseWxhYj0iWSIp"),globals())+"<br />n"); execfile(os.path.abspath("<span class="underline"> _code</span> _.py"))
</p>
</blockquote>
<p>
File "", line 1, in <module>
</p>
</blockquote>
<blockquote>
<p>
File "/tmp/tmpFygLc1/<span class="underline"> _code</span> _.py", line 3, in <module>
</p>
<blockquote>
<p>
r.png()
</p>
</blockquote>
<p>
File "/home/sage/sage-5.6/local/lib/python2.7/site-packages/sage/interfaces/r.py", line 364, in png
</p>
<blockquote>
<p>
raise <a class="missing wiki">RuntimeError?</a> , "R was not compiled with PNG support"
</p>
</blockquote>
</blockquote>
<p>
<a class="missing wiki">RuntimeError?</a>: 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 <strong>without X relay</strong> :<br />L$: ssh sage@…<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 <strong>with X relay</strong>. 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 <strong>AND</strong> 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 />
</p>
<ul><li>had your server had access at start time ? ?
</li><li>had you X access at time of use ?
</li><li>had your server X access at time of use ?"
</li></ul><p>
The original mail got 14 views and no answer.
</p>
<p>
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).
</p>
<p>
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 <a class="missing wiki">RealLife?</a>(TM) constraints. I plan to gp a$back to the R building mechanism as invoked from Sage building mechanism.
</p>
<p>
Any further information will still be appreciated, especially from Sage R maintainers...
</p>
TicketkcrismanThu, 07 Feb 2013 01:23:23 GMTcc set
https://trac.sagemath.org/ticket/14071#comment:2
https://trac.sagemath.org/ticket/14071#comment:2
<ul>
<li><strong>cc</strong>
<em>jason</em> <em>kcrisman</em> added
</li>
</ul>
<p>
Thanks for this in-depth digging at the problem.
</p>
<blockquote class="citation">
<p>
From this brief trial, I conclude that the Sage server must be started in an environment where X is accessible <strong>AND</strong> must have some access to X to be able to produce png graphs.
</p>
</blockquote>
<p>
You may very well be right. It has been hard for us to reliably figure out exactly what is needed for this, though it turns out X is probably not necessary per se (we ask for it when compiling and so it probably asks for it). I think Jason discovered that various fonts were more important than that...
</p>
TicketjdemeyerTue, 13 Aug 2013 15:35:53 GMTmilestone changed
https://trac.sagemath.org/ticket/14071#comment:3
https://trac.sagemath.org/ticket/14071#comment:3
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.11</em> to <em>sage-5.12</em>
</li>
</ul>
Ticketvbraun_spamThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/14071#comment:4
https://trac.sagemath.org/ticket/14071#comment:4
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
Ticketvbraun_spamTue, 06 May 2014 15:20:58 GMTmilestone changed
https://trac.sagemath.org/ticket/14071#comment:5
https://trac.sagemath.org/ticket/14071#comment:5
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
Ticketvbraun_spamSun, 10 Aug 2014 16:51:03 GMTmilestone changed
https://trac.sagemath.org/ticket/14071#comment:6
https://trac.sagemath.org/ticket/14071#comment:6
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.3</em> to <em>sage-6.4</em>
</li>
</ul>
TicketchapotonMon, 21 Sep 2020 18:59:10 GMTcc, status, milestone changed
https://trac.sagemath.org/ticket/14071#comment:7
https://trac.sagemath.org/ticket/14071#comment:7
<ul>
<li><strong>cc</strong>
<em>mkoeppe</em> <em>dimpase</em> added
</li>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>milestone</strong>
changed from <em>sage-6.4</em> to <em>sage-duplicate/invalid/wontfix</em>
</li>
</ul>
<p>
can we close as obsolete ?
</p>
TicketdimpaseMon, 21 Sep 2020 19:34:45 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/14071#comment:8
https://trac.sagemath.org/ticket/14071#comment:8
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Dima Pasechnik</em>
</li>
</ul>
<p>
sure
</p>
TicketmkoeppeMon, 21 Sep 2020 19:43:37 GMTauthor deleted
https://trac.sagemath.org/ticket/14071#comment:9
https://trac.sagemath.org/ticket/14071#comment:9
<ul>
<li><strong>author</strong>
<em>charpent</em> deleted
</li>
</ul>
TicketchapotonMon, 21 Sep 2020 20:08:46 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/14071#comment:10
https://trac.sagemath.org/ticket/14071#comment:10
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
Ticket