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

Paul Johnson pauljohn32 at gmail.com
Fri Jun 4 23:14:33 CEST 2010


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

---------- Forwarded message ----------
From: Tom "spot" Callaway <tcallawa at redhat.com>
Date: Thu, Jun 3, 2010 at 12:03 PM
Subject: Re: How to go about getting a change in the SPEC file from
which R is 	built on EPEL?
To: Paul Johnson <pauljohn32 at gmail.com>
Cc: r-sig-fedora at r-project.org


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:

* Architecture specific R modules go into %{_libdir}/R/library
* Architecture independent R modules go into %{_datadir}/R/library

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



More information about the R-devel mailing list