Opened 10 years ago

Last modified 6 years ago

#8868 new enhancement

Make R graphics work regardless of X and other things

Reported by: kcrisman Owned by: jason, was
Priority: minor Milestone: sage-6.4
Component: graphics Keywords: r-project
Cc: drkirkby Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

See #8834, where doctests for R graphics had to be made optional. However, it should be possible for R to always return graphics, if only we understand better how the device selection works.

Change History (17)

comment:1 Changed 10 years ago by kcrisman

Some comments from #8834: R install guide says:

Unless you do not want to view graphs on-screen you need ‘X11’ installed, including its headers and client libraries. For recent Fedora distributions it means (at least) ‘libX11’, ‘libX11-devel’, ‘libXt’ and ‘libXt-devel’. On Debian we recommend the meta-package ‘xorg-dev’. If you really do not want these you will need to explicitly configure R without X11, using --with-x=no.

But see this, which talks about the devices more generally, as well as the R_DEFAULT_DEVICE variable. In particular, the pdf output, or png via the bitmap function, could be platform-independent enough to reinstate doctests for R graphics. Though the bitmap function apparently needs ghostscript, though, which we also can't always count on being present, I don't think.

comment:2 Changed 10 years ago by kcrisman

Of course, if X or Aqua *are* available, we would totally want to have the ability to use them, via interactive output. But for things like the notebook, we really only want to generate one image at a time, for which anything that makes pdf or png should be appropriate, at least to my way of thinking about this.

comment:3 Changed 9 years ago by jbandlow

I'm recording here what I learned while exploring this ask.sagemath question. Namely, on Ubuntu, the packages xorg-dev and libpng are prerequisites for R graphics to work.

comment:4 follow-up: Changed 9 years ago by kcrisman

  • Cc drkirkby added

Hmm, that's bad. We include libpng as part of Sage, as far as I know (libpng-1.2.35.p2.spkg). So somehow R wasn't picking up the Sage copy of libpng. That is very interesting. And bad.

cc:ing drkirkby only because he knows about Sage components picking up (or not) non-Sage libraries.

comment:5 in reply to: ↑ 4 Changed 9 years ago by drkirkby

Replying to kcrisman:

Hmm, that's bad. We include libpng as part of Sage, as far as I know (libpng-1.2.35.p2.spkg). So somehow R wasn't picking up the Sage copy of libpng. That is very interesting. And bad.

cc:ing drkirkby only because he knows about Sage components picking up (or not) non-Sage libraries.

Using Sage 4.6.1.alpha0 on my OpenSolaris 06/2009 machine, I just run those two commands given on ask.sagemath.question:

sage:  r.eval('capabilities("png")')
'  png \nFALSE '
sage: r.eval('capabilities("X11")')
'  X11 \nFALSE '
sage: 

looks like I have neither PNG or X support built in. This is odd. When I check spkg/logs/r-2.10.1.p4.log I see:

checking if libpng version >= 1.0.5... yes

then later

R is now configured for i386-pc-solaris2.11

  Source directory:          .
  Installation directory:    /export/home/drkirkby/sage-4.6.1.alpha0/local

  C compiler:                gcc -std=gnu99  -I/export/home/drkirkby/sage-4.6.1.alpha0/local/include -L/export/home/drkirkby/sage-4.6.1.alpha0/local/lib/
  Fortran 77 compiler:       sage_fortran  -g -O2

  C++ compiler:              g++  -g -O2
  Fortran 90/95 compiler:    sage_fortran -g -O2
  Obj-C compiler:

  Interfaces supported:
  External libraries:        readline
  Additional capabilities:   PNG, JPEG, TIFF, NLS
  Options enabled:           shared R library, shared BLAS, R profiling, Java

  Recommended packages:      yes

So despite PNG support apparently built in, r.eval('capabilities("png")') indicates otherwise.

It's difficult to know what to trust.

Dave

comment:6 Changed 9 years ago by kcrisman

Just putting this info here - from this thread:

This binary package works for me without having xorg-dev packages/ 
headers installed, i.e. 
sage -sh 
R 
demo(graphics) 
produces the demo-plots. During creation of the binaries the headers 
are needed, but not for execution

comment:7 follow-up: Changed 9 years ago by kcrisman

See also this R-devel thread for more information which may lead us to a resolution.

comment:8 in reply to: ↑ 7 Changed 9 years ago by kcrisman

Replying to kcrisman:

See also this R-devel thread for more information which may lead us to a resolution.

In particular, it looks like one has to compile on a machine (if Linux) that has a working display in order for png to pick up the X11. That sounds weird to me, but it's how it's written. Or we have to use Cairo, which I don't know that we want to add to the tarball.

comment:9 Changed 9 years ago by jason

I solved this on Ubuntu by installing the libpango1.0-dev and libcairo-dev packages. I had also earlier installed the xorg-dev package, but I don't know if it is actually needed here.

comment:10 Changed 9 years ago by kcrisman

Thanks, Jason.

To other readers - see also the whole R-devel thread, where a slew of possible configure and download options are mentioned. Yikes!

A resolution of this ticket may end up consisting of adding precise instructions for how to make this work on a given Linux, assuming it works all the time on Mac (perhaps a dangerous assumption, but one I haven't seen go wrong yet on this issue; maybe I need to test it more widely).

comment:11 Changed 9 years ago by kcrisman

See also #11249 for a related ticket.

comment:12 Changed 8 years ago by vbraun

I made a new R (r-project) spkg at #12057, this gives me working PNG output without any X11 headers installed. If #12057 fixes any issues you might have, we can close this ticket imho.

comment:13 Changed 8 years ago by kcrisman

  • Keywords r-project added

comment:14 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:15 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:16 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:17 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.