Re: R dependencies

2015-09-11 Thread Vicente Vera
Hello again,

Finally solved this:

Error in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 2 at size
11 could not be loaded

The problem arose because R wasn't using cairo for font rendering.
Some simple configurations in ~/.Rprofile solved it:

setHook(packageEvent("grDevices", "onLoad"),
function(...) grDevices::X11.options(type = "cairo",
 antialias = "subpixel"))

The code changes the X11 device (used for plotting) type from "XLib"
to "cairo", once it gets called.

(just for the record, i'm not using GuixSD)

2015-09-03 11:55 GMT-03:00 Vicente Vera :
> Hi,
>
> Sure. The error message is this:
>
> X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 5 at size
> 15 could not be loaded
>
> No plot is being drawn; only a blank window appears.
>
> The code:
>
> ggplot(data = fig1, aes(x = Var1, y = Freq, fill =
> brewer.pal(length(levels(the_data$VARIABLE1)), "Set3"))) +
> geom_bar(stat = "identity") +
> scale_fill_identity() +
> labs(x = "x", y = "y") +
> geom_text(aes(label = perc), vjust = 2, size = 4, colour =
> "black", fontface = "bold") +
> scale_x_discrete(labels = c("a", "b", "c")) +
> theme(panel.background = element_blank(),
>   line = element_blank(),
>   axis.text.y = element_blank())
>
> On my base system, R 3.2.1 + ggplot2 draws the plot with no problem.
>
> It might be related to a missing font or font alias in the Guix store
> (not familiar enough with it to catch the issue).
>
> Now, I didn't installed ggplot2 through Guix, so that could be a problem.
>
> 2015-09-03 3:29 GMT-03:00 Ricardo Wurmus :
>> Hi Vicente,
>>
>>> Going back to the R dependencies topic, I ran across an issue when
>>> trying to draw a plot (with ggplot2). But first some context:
>>>
>>> - I'm not using GuixSD but a binary installation over Manjaro OpenRC;
>>> several base packages missing on Guix
>>> - I only have other two Guix packages installed: xpdf & abbaye
>>
>> All Guix packages capture the complete graph of dependencies, so you’ll
>> always end up with the dependent packages in ‘/gnu/store’ even if only
>> those packages appear in your profile that have been explicitly
>> installed.
>>
>>> - I installed ggplot2 through install.packages("ggplot2") in R (Guix 
>>> package)
>>
>> Note that ggplot2 has been packaged for Guix:
>>
>> guix package -i r-ggplot2
>>
>>> R complained about some fonts missing, but I think it could be related
>>> to a missing X11 dependency (complete Xorg maybe?). What could it be?
>>
>> What is the exact error message you get?  Is any plot drawn at all?
>> What is the code you use to draw the plot?
>>
>> ~~ Ricardo
>>



Re: [PATCH] R dependencies

2015-09-05 Thread Ludovic Courtès
Now the closure of R is down from 5 GiB to 518 MiB, which is cool.  :-)

It seems we might be able to go further, because somewhere there are
presumably unwanted dependencies being retained, such as Texinfo & Perl,
ld-wrapper & Binutils, Gawk and other build-time tools:

--8<---cut here---start->8---
$ guix size r
substitute: updating list of substitutes from 'http://hydra.gnu.org'... 100.0%
store item   totalself
/gnu/store/yqng7qmf0jrq8lkbivqpifx83rqmym61-r-3.2.2518.0
55.5  10.7%
/gnu/store/2x8w06phz69hq7yr457xy0n46vws0wpl-texinfo-6.0154.5 
8.0   1.5%
/gnu/store/mziw9w93gxb1qd0ikxj6zx2w238995lg-ld-wrapper-0   152.3 
0.0   0.0%
/gnu/store/gjs5zk5366a4bdwyy6vv1x8cfx7b092m-perl-5.16.1140.2
49.2   9.5%
/gnu/store/chc76a6vpwl2cb7pq1qwl6b1ws6xagqv-cairo-1.14.2   135.8 
6.1   1.2%
/gnu/store/jcdqm0221hcq39bbbxa6z2kmkfhy27r0-icu4c-55.1 125.9
34.9   6.7%
/gnu/store/5ibx7chxjqr5mnmg0glsx41l85rmwp81-openblas-0.2.14120.2
60.0  11.6%
/gnu/store/ig1ibsz49ng15p0x6vlild3qfnlhwwx8-libxt-1.1.4110.7 
2.7   0.5%
/gnu/store/0ah2z399hmqm5mk9arw6rlywz836j8zy-guile-2.0.11   107.9
16.1   3.1%
/gnu/store/1ncynbg14adkn9a277b8zc1qjq6kswfy-glib-2.44.0101.6
13.1   2.5%
/gnu/store/xnyf5pzlwrq35qv47g3w70jagsgm1djz-libsm-1.2.2 92.3 
0.3   0.1%
/gnu/store/2afa3pvl8amwb4ql8xk6q8gfvwk143l5-util-linux-2.25.2   91.5
10.8   2.1%
/gnu/store/xz3mf13izfr44135w0760vzxga5v0950-bash-4.3.39 87.9 
6.3   1.2%
[...]
--8<---cut here---end--->8---

It Would Be Nice™ to identify where these references come from and
whether they can be discarded.

Thanks,
Ludo’.



Re: [PATCH] R dependencies

2015-09-03 Thread Ludovic Courtès
Ricardo Wurmus  skribis:

> From 11e8a484733b492ff5ecd6119b9bdef238be6e67 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus 
> Date: Thu, 3 Sep 2015 11:41:07 +0200
> Subject: [PATCH 1/3] gnu: r: Drop IcedTea from inputs.
>
> * gnu/packages/statistics.scm (r)[inputs]: Remove "icedtea6".

[...]

> From 17f4d01ce2b7bb4b41e565ac43463425e79b6c30 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus 
> Date: Thu, 3 Sep 2015 11:41:36 +0200
> Subject: [PATCH 2/3] gnu: r: Install info documentation.
>
> * gnu/packages/statistics.scm (r)[arguments]: Add phases "make-info" and
>   "install-info" to build and install info documentation.

[...]

> From d4982f4574579fe60e005807aace966279824f01 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus 
> Date: Thu, 3 Sep 2015 12:09:47 +0200
> Subject: [PATCH 3/3] gnu: r: Drop texlive from native-inputs.
>
> * gnu/packages/statistics.scm (r)[native-inputs]: Remove "texlive".

OK for all three.  Thanks for taking the time to investigate!

Ludo’.



Re: R dependencies

2015-09-03 Thread Vicente Vera
Hi,

Sure. The error message is this:

X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 5 at size
15 could not be loaded

No plot is being drawn; only a blank window appears.

The code:

ggplot(data = fig1, aes(x = Var1, y = Freq, fill =
brewer.pal(length(levels(the_data$VARIABLE1)), "Set3"))) +
geom_bar(stat = "identity") +
scale_fill_identity() +
labs(x = "x", y = "y") +
geom_text(aes(label = perc), vjust = 2, size = 4, colour =
"black", fontface = "bold") +
scale_x_discrete(labels = c("a", "b", "c")) +
theme(panel.background = element_blank(),
  line = element_blank(),
  axis.text.y = element_blank())

On my base system, R 3.2.1 + ggplot2 draws the plot with no problem.

It might be related to a missing font or font alias in the Guix store
(not familiar enough with it to catch the issue).

Now, I didn't installed ggplot2 through Guix, so that could be a problem.

2015-09-03 3:29 GMT-03:00 Ricardo Wurmus :
> Hi Vicente,
>
>> Going back to the R dependencies topic, I ran across an issue when
>> trying to draw a plot (with ggplot2). But first some context:
>>
>> - I'm not using GuixSD but a binary installation over Manjaro OpenRC;
>> several base packages missing on Guix
>> - I only have other two Guix packages installed: xpdf & abbaye
>
> All Guix packages capture the complete graph of dependencies, so you’ll
> always end up with the dependent packages in ‘/gnu/store’ even if only
> those packages appear in your profile that have been explicitly
> installed.
>
>> - I installed ggplot2 through install.packages("ggplot2") in R (Guix package)
>
> Note that ggplot2 has been packaged for Guix:
>
> guix package -i r-ggplot2
>
>> R complained about some fonts missing, but I think it could be related
>> to a missing X11 dependency (complete Xorg maybe?). What could it be?
>
> What is the exact error message you get?  Is any plot drawn at all?
> What is the code you use to draw the plot?
>
> ~~ Ricardo
>



[PATCH] R dependencies

2015-09-03 Thread Ricardo Wurmus

Ludovic Courtès  writes:

> Speaking of which: should we get rid of icedtea6:jdk in the default R
> package (closure size: 1GiB), and maybe of TeX Live (4GiB)?  Or should
> we provide, say, ‘r-light’ with the definition above?
>
> I’m afraid having these two dependencies by default makes it
> prohibitively expensive.

I investigated this a bit and found that the JDK is not really needed at
build time.  The first patch includes a comment explaining why we
dropped the JDK from the inputs.

The second patch adds build phases to install the info documentation.

Removing texlive is possible as well, but it results in the loss of the
following files:

./lib/R/library/grid
  /doc
displaylist.R
displaylist.Rnw
frame.R
frame.Rnw
grid.R
grid.Rnw
grobs.R
grobs.Rnw
index.html
interactive.R
interactive.Rnw
locndimn.R
locndimn.Rnw
moveline.R
moveline.Rnw
nonfinite.R
nonfinite.Rnw
plotexample.R
plotexample.Rnw
rotated.R
rotated.Rnw
saveload.R
saveload.Rnw
sharing.R
sharing.Rnw
viewports.R
viewports.Rnw
  /Meta
vignette.rds

./lib/R/library/parallel
  /doc
index.html
parallel.R
parallel.Rnw
  /Meta
vignette.rds

./lib/R/library/utils
  /doc
index.html
Sweave.R
Sweave.Rnw
  /Meta
vignette.rds

Note that these Rnw files are all literate programming sources
containing the sources that are untangled to .R files and the PDF
documentation.  Interestingly, the source tarball already contains the
PDF files (e.g. the one installed to
“lib/R/library/grid/doc/viewports.pdf”), so we don’t need texlive to
generate them.

Attached are the three patches.

~~ Ricardo

>From 11e8a484733b492ff5ecd6119b9bdef238be6e67 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus 
Date: Thu, 3 Sep 2015 11:41:07 +0200
Subject: [PATCH 1/3] gnu: r: Drop IcedTea from inputs.

* gnu/packages/statistics.scm (r)[inputs]: Remove "icedtea6".
---
 gnu/packages/statistics.scm | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index b84c48d..b1cc5cf 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -84,6 +84,16 @@
  "--with-system-pcre"
  "--with-system-tre"
  "--with-system-xz")))
+;; R has some support for Java.  When the JDK is available at configure
+;; time environment variables pointing to the JDK will be recorded under
+;; $R_HOME/etc and ./tools/getsp.java will be compiled which is used by "R
+;; CMD javareconf".  "R CMD javareconf" appears to only be used to update
+;; the recorded environment variables in $R_HOME/etc.  Refer to
+;; https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
+;; for additional information.
+
+;; As the JDK is a rather large input with only very limited effects on R,
+;; we decided to drop it.
 (native-inputs
  `(("bzip2" ,bzip2)
("perl" ,perl)
@@ -97,7 +107,6 @@
("cairo" ,cairo)
("gfortran" ,gfortran)
("icu4c" ,icu4c)
-   ("icedtea6" ,icedtea6 "jdk")
("lapack" ,lapack)
("libjpeg" ,libjpeg)
("libpng" ,libpng)
-- 
2.1.0

>From 17f4d01ce2b7bb4b41e565ac43463425e79b6c30 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus 
Date: Thu, 3 Sep 2015 11:41:36 +0200
Subject: [PATCH 2/3] gnu: r: Install info documentation.

* gnu/packages/statistics.scm (r)[arguments]: Add phases "make-info" and
  "install-info" to build and install info documentation.
---
 gnu/packages/statistics.scm | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index b1cc5cf..ec705c2 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -68,7 +68,11 @@
  (add-before
   'check 'set-timezone
   ;; Some tests require the timezone to be set.
-  (lambda _ (setenv "TZ" "UTC") #t)))
+  (lambda _ (setenv "TZ" "UTC") #t))
+ (add-after 'build 'make-info
+  (lambda _ (zero? (system* "make" "info"
+ (add-after 'build 'install-info
+  (lambda _ (zero? (system* "make" "install-info")
#:configure-flags
'("--with-blas=openblas"
  "--with-lapack"
-- 
2.1.0

>From d4982f4574579fe60e005807aace966279824f01 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus 
Date: Thu, 3 Sep 2015 12:09:47 +0200
Subject: [PATCH 3/3] gnu: r: Drop texlive from native-inputs.

* gnu/packages/statistics.scm (r)[native-inputs]: Remove "texlive".
---
 gnu/packages/statistics.scm | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index ec705c2..7cb61c9 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -102,7 +102,6 @@
  `(("bzip2" ,bzip2)
("perl" ,perl)
("pkg-config" ,pkg-config)
-   ("texlive" ,texlive) ; needed to 

Re: R dependencies

2015-09-02 Thread Ricardo Wurmus
Hi Vicente,

> Going back to the R dependencies topic, I ran across an issue when
> trying to draw a plot (with ggplot2). But first some context:
>
> - I'm not using GuixSD but a binary installation over Manjaro OpenRC;
> several base packages missing on Guix
> - I only have other two Guix packages installed: xpdf & abbaye

All Guix packages capture the complete graph of dependencies, so you’ll
always end up with the dependent packages in ‘/gnu/store’ even if only
those packages appear in your profile that have been explicitly
installed.

> - I installed ggplot2 through install.packages("ggplot2") in R (Guix package)

Note that ggplot2 has been packaged for Guix:

guix package -i r-ggplot2

> R complained about some fonts missing, but I think it could be related
> to a missing X11 dependency (complete Xorg maybe?). What could it be?

What is the exact error message you get?  Is any plot drawn at all?
What is the code you use to draw the plot?

~~ Ricardo




Re: R dependencies

2015-09-02 Thread Vicente Vera
Hello,

Going back to the R dependencies topic, I ran across an issue when
trying to draw a plot (with ggplot2). But first some context:

- I'm not using GuixSD but a binary installation over Manjaro OpenRC;
several base packages missing on Guix
- I only have other two Guix packages installed: xpdf & abbaye
- I installed ggplot2 through install.packages("ggplot2") in R (Guix package)

R complained about some fonts missing, but I think it could be related
to a missing X11 dependency (complete Xorg maybe?). What could it be?

2015-09-02 10:09 GMT-03:00 Ludovic Courtès :
> Ricardo Wurmus  skribis:
>
>> An alternative is to inherit from the “r” package in “statistics.scm”.
>>
>> (define-module (my own packages)
>>   #:use-module (guix packages)
>>   #:use-module (gnu packages statistics)
>>   #:use-module (srfi srfi-1))
>>
>> (define-public my-r
>>   (package (inherit r)
>> (name "my-r")
>> ;; modify only the inputs here
>> (native-inputs (alist-delete "texlive" (package-native-inputs r)))
>> (inputs (alist-delete "icedtea6" (package-inputs r)
>
> Speaking of which: should we get rid of icedtea6:jdk in the default R
> package (closure size: 1 GiB), and maybe of TeX Live (4 GiB)?  Or should
> we provide, say, ‘r-light’ with the definition above?
>
> I’m afraid having these two dependencies by default makes it
> prohibitively expensive.
>
> Ludo’.



R dependencies

2015-09-02 Thread Ludovic Courtès
Ricardo Wurmus  skribis:

> An alternative is to inherit from the “r” package in “statistics.scm”.
>
> (define-module (my own packages)
>   #:use-module (guix packages)
>   #:use-module (gnu packages statistics)
>   #:use-module (srfi srfi-1))
>   
> (define-public my-r
>   (package (inherit r)
> (name "my-r")
> ;; modify only the inputs here
> (native-inputs (alist-delete "texlive" (package-native-inputs r)))
>
> (inputs (alist-delete "icedtea6" (package-inputs r)

Speaking of which: should we get rid of icedtea6:jdk in the default R
package (closure size: 1 GiB), and maybe of TeX Live (4 GiB)?  Or should
we provide, say, ‘r-light’ with the definition above?

I’m afraid having these two dependencies by default makes it
prohibitively expensive.

Ludo’.