[Rd] Renviron settings for Linux Distributions: please tell me R Core's advice

From: Paul Johnson <pauljohn32_at_gmail.com>
Date: Fri, 04 Jun 2010 16:14:33 -0500


Dear R-devel:

i have noticed a little wrinkle in R packaging for RPM systems and have communicated with the package maintainer at RedHat Tom Callaway (see far below).

Here is the question:

Where does R Core Team want packagers to fiddle around with R library paths?

Currently, the RPM Spec file used for EPEL's R (For Fedora/Redhat/Centos,etc) adds a line in R_HOME/etc/Renviron like this:

R_LIBS=${R_LIBS-'"'%{_libdir}/R/library:%{_datadir}/R/library'"'}'

Setting R_LIBS has some bad effects. It seems to block R_LIBS_USER, so users who try to install packages are not invited to install them in ~/R/i386... as they are invited to do on Ubuntu.

On Ubuntu, Renviron file has been modified thus:

R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/2.11'} R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}

That has a nice effect. They set the default install library to /usr/local/lib/R/site-library, so things that local admin builds are separate from the packaged stuff, which goes into /usr/lib/R/library.

I'm not the packager, but I'm in communication with him and this is a good time to get it right, from your point of view. Tom suggests that the RPM packaging should manipulate R_LIBS_SITE, which I think is better than R_LIBS.

However, in the documentation for the base Startup, the R docs say

"The file ‘R_HOME/etc/Renviron’ is always read very early in the start-up processing. It contains environment variables set by R in the configure process. Values in that file can be overridden in site or user environment files: do not change ‘R_HOME/etc/Renviron’ itself. Note that this is distinct from ‘R_HOME/etc/Renviron.site’."

That's addressing post-install admin, not packagers, right? Is there another recommended place to make the changes that we want to make?

pj

On 06/03/2010 12:14 PM, Paul Johnson wrote:
> R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}
>
> I wondered why the RedHat/Fedora install of the R RPM don't see
> same/similar options. On Fedora/RedHat using R from RPM as distributed
> on EPEL, all the packages go into /usr/lib/R and nonroot users are out
> of luck, pretty much, unless they make some special effort.
>
> There was some debate here about what the folder in the user home dir
> should be called, but none of us realized that R, as it comes from the
> "factory", will work pretty much the way I want.
>
> The problem is that the RPM is built from a SPEC file that inserts a
> line into R's Renviron that enforces a  variable
> R_LIBS and it has some kind of super power to block the R_LIBS_SITE
> and R_LIBS_USER variables.  Specifically, I mean this line in the SPEC
> file.
>
> %build
> Add PATHS to Renviron for R_LIBS
> echo 'R_LIBS=${R_LIBS-'"'%{_libdir}/R/library:%{_datadir}/R/library'"'}'
>>> >> etc/Renviron.in
> On my systems, I comment out those lines in the spec file and then R
> works the way the authors intended.  Judging from the comments that
> Dirk Eddelbuettel inserted in the Debian packaging, sometime around
> 2007 the R LIBS framework changed.

So, a few corrections:

On Fedora:

I don't believe that without making some change, R will look in %{_datadir}/R/library at all.

It looks like we should be overloading R_LIBS_SITE as opposed to R_LIBS.

Easy peasy. :)

Can you try changing that line in the spec file to this and confirm that it resolves the issue:

echo
'R_LIBS_SITE=${R_LIBS_SITE-'"'/usr/local/lib/R/site-library:/usr/local/lib/R/library:%{_libdir}/R/library:%{_datadir}/R/library'"'}'
>> etc/Renviron.in

(Note: email client wrapped it, but it should be one long line)

~spot

-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 04 Jun 2010 - 21:21:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Jun 2010 - 10:30:57 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive