Opened 8 years ago

Closed 4 months ago

#14071 closed defect (invalid)

In Sage notebook, R graphics capabilities depend on the *current* running environment

Reported by: charpent Owned by: tbd
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords: r-project graphics
Cc: jason, kcrisman, mkoeppe, dimpase Merged in:
Authors: Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description


Change History (10)

comment:1 follow-up: Changed 8 years ago 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.

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 :

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 trac#14008 installed) in the home directory of the "sage" user.

in L : create a ssh redirection from L to S on some suitably chosen port xxxxx :
L : ssh -f -N -L:xxxxx:localhost:xxxxx SSS.SSS.SSS.SSS

login to S from L with an ssh connection relaying X :
L$: ssh -Y sage@…

In this terminal, start the sage server :
sage -n directory=/home/sage/sage_notebooks.sagenb/ port=xxxxx automatic_login=False &
DO NOT LOGOUT FROM THI SSH SESSION NOW !

in L, start a browser and go to localhost:xxxxx
Log in
Create a small test worksheet :
first cell :
r('capabilities("png")')
you get the R answer :

   png 
  TRUE 

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

  null device 
            1 

then a graph [ Not reproduced here, see original post).

This is OUTPUT 1 from now on.

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

[[BR]] png[[BR]]FALSE[[BR]]

And the second (after expansion) :
{{{ 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 }}}
This is OUTPUT 2 from now on.

Now, go back to your terminal and reconect to S without X relay :
L$: ssh sage@…

Going back to the browser, restart the worksheet and evaluate all cells. You get OUTPUT TWO (modulo the points of the graph, of course).

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.

!!!!!

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.

I also tried to start my port redirection with X relay, to no avail. : you get OUTPUT 2...

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.

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.

A couple more data points : when running "sage -R" from an X-enabled ssh connection :
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE FALSE TRUE TRUE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE TRUE TRUE TRUE FALSE FALSE

whereas "native R" (as packaged by Dirk Ettelbuettel for Debian unstable) :
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE TRUE TRUE TRUE TRUE TRUE


When running "sage -R" from a X-disabled ssh connection :
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets
FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE TRUE TRUE TRUE FALSE FALSE

"native R":
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE TRUE TRUE TRUE TRUE TRUE

"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...

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...).

The original mail ended with the following plea :
"I'd like to collect your experiences about this problem : When you have experienced the "no PNG capability" problem :

  • 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...

comment:2 in reply to: ↑ 1 Changed 8 years ago by kcrisman

  • Cc jason kcrisman added

Thanks for this in-depth digging at the problem.

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.

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...

comment:3 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:4 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:5 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:6 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:7 Changed 4 months ago by chapoton

  • Cc mkoeppe dimpase added
  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

can we close as obsolete ?

comment:8 Changed 4 months ago by dimpase

  • Reviewers set to Dima Pasechnik
  • Status changed from needs_review to positive_review

sure

comment:9 Changed 4 months ago by mkoeppe

  • Authors charpent deleted

comment:10 Changed 4 months ago by chapoton

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.