[R-sig-Debian] Debian Testing: ~/.Renviron seems to not being read (R_LIBS not set)

Marius Hofert marius.hofert at uwaterloo.ca
Thu Apr 2 03:17:27 CEST 2015

On Tue, Mar 31, 2015 at 2:05 AM, Johannes Ranke <jranke at uni-bremen.de> wrote:
> Dear Marius,
> thanks for sharing your thoughts on this. I am not very happy that you provide
> instructions to install R 3.1.3 from sources when binaries are already
> provided on CRAN.

Dear Johannes,

... no one in his/her clear mind would go that way unless necessary. I
have given reasons for when and why it is necessary.

> The installation instructions you share bring more work and
> a more non-standard setup, unless you want two different copies of R. But your
> instructions do not cover that case!

... because it is trivial from the procedure I described. Replace the
version number by 'devel' or 'rc' (for patched) and the rest remains
pretty much the same (obviously adapting the download link).

> From my point of view it could be interesting if it were modified for keeping
> an up to date copy of R-devel in addition to the released version,

yes, that's a use case. Or if you need >= 2 R versions to check back
with older versions or if a user with a different R version reports a
bug and you can not reproduce it with the version you have etc...

>  but in the
> way you are giving it here I think it may lead people to be distracted from
> the easy and clean way to do it. I say clean, because when you use the .deb
> packages it is much easier to remove or revert what you have done.

I frequently install new R-devel versions... simply removing
/usr/local/R/R-devel* first. There might be side-effects I don't know,
but that never gave me problems.

> So maybe you could modify your instructions to the case where someone wants to
> have R-devel in addition to the released R version, if that is what you are
> aiming at? I could then add it to the README for Debian on CRAN.

That sounds good. I just modified the instructions to R-devel and used
a more "Kurt-like" naming convention:

1) sudo nano /etc/apt/sources.list
   deb http://stat.ethz.ch/CRAN/bin/linux/debian jessie-cran3/
   deb-src http://stat.ethz.ch/CRAN/bin/linux/debian jessie-cran3/
2) sudo apt-get update # => fails, but note the number of the missing
public key; then do:
   sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key
<NUMBER> # <NUMBER> = number after NO_PUBKEY
3) Build dependencies (compilers etc.):
   sudo apt-get build-dep r-base
4) Install path:
   sudo mkdir /usr/local/R
   sudo chown <user>:<user> /usr/local/R
5) Get and unpack R:
   cd /usr/local/R
   # if it exists, delete the old ./R-devel, ./R-devel-build,
./R-devel.tar.gz etc. then do:
   wget ftp://ftp.stat.math.ethz.ch/Software/R/R-devel.tar.gz # see
CRAN -> R Sources for the link
   tar -xzf R-devel.tar.gz
   mv R-devel R-devel_source
6) Set up build directory (don't use ./configure within source
directory; sources would be lost)
   mkdir R-devel_build
7) Configure:
   cd R-devel_build
   ../R-devel_source/configure # ~2min
8) Build:
   make # 10min (desktop); much longer on Android (seems to hang but
just let it run!)
   make check # ~3min
   make pdf # ~2min
   make info # ~1min
9) Create a (symbolic) link (don't use 'make install'):
   cd ..
   ln -s /usr/local/R/R-devel_build/bin/R /usr/local/R/R-devel
10) mkdir /usr/local/R/library
11) Add /usr/local/R to PATH:
    sudo nano /etc/bash.bashrc # then put in:
    PATH=/usr/local/R:$PATH # R installation
12) Reboot

Clearly, some words (of warning) are in order ..., e.g., to use $USER
in 4) instead of <user>, to adapt the right path in 5), to have tools
like tar available or also to maybe choose some other file than
/etc/bash.bashrc for adjusting PATH (see
http://forums.debian.net/viewtopic.php?f=5&t=121169 for why I chose
this file).

I very much like Dirk's message here: "That's your beef" (good word of
warning), but someone who needs to go that way should be able to
follow along the above lines.

> And then, regarding your comment on the keyserver listed in the README, what's
> wrong with keys.gnupg.net? I just tested it (again) and it worked fine.

... there was a problem for me initially (some kind of
host-resolve-thingy -- can't remember anymore). After googling, I then
found the other key server and it was also suggested to use the actual
key the error message mentions (see step 2)) instead of the fixed
381BA480. I understand too little about the involved risk of changing
that but the above worked for me.

Many cheers (and sorry for the late reply -- it's end-of-term),

> Kind regards,
> Johannes
> Am Montag, 30. März 2015, 20:42:47 schrieb Marius Hofert:
>> Dear Dirk, Dear Johannes,
>> Thanks for helping, I could solve the problem.
>> By reading your posts, I got a bit of the impression that questions
>> beyond the 'standard installation' process are not really welcome on
>> R-SIG-Debian. If this is the case, I'm sorry for my post. I wasn't
>> aware of this, but Dirk makes it clear why on
>> https://stat.ethz.ch/pipermail/r-sig-debian/2013-March/002062.html.
>> As Dirk also mentioned on
>> http://stackoverflow.com/questions/8343686/how-to-install-2-different-r-vers
>> ions-on-debian installing from source is the only practical way in case one
>> needs several R versions. I now went back to Chapter 2 of
>> http://cran.r-project.org/doc/manuals/r-release/R-admin.html to read
>> more about it and to see whether I have done something substantially
>> wrong. This seemed not to be the case.
>> Next, Dirk's wonderful little example helped... I could check that
>> .Renviron is indeed found. Then it was easy: my local
>> version-independent library was not found simply because .libPaths()
>> only contains those folders which physically exist (also mentioned on
>> ?.libPaths). And indeed, I had not checked that.
>> Here is thus the final solution that worked (in case useful for others
>> or being improved upon [slightly expanded in comparison to the
>> original one, e.g., also addressing how to obtain a key -- the server
>> is different than keys.gnupg.net mentioned on CRAN.]):
>> 1) sudo emacs /etc/apt/sources.list # then add: deb
>>    http://stat.ethz.ch/CRAN/bin/linux/debian jessie-cran3/ deb-src
>>    http://stat.ethz.ch/CRAN/bin/linux/debian jessie-cran3/ # => then run
>> sudo apt-get update. It fails due to a missing key => note the missing key
>> number # and use sudo apt-key adv --keyserver keyserver.ubuntu.com
>> --recv-key <NUMBER> where # <NUMBER> = number of the missing public key
>> 2) sudo apt-get build-dep r-base
>> 3) sudo mkdir /usr/local/R sudo chown mhofert:mhofert /usr/local/R
>>    cd /usr/local/R # if old versions exist (./R-devel, ./R-devel-build,
>>    ./R-devel.tar.gz etc.), # delete them first, then do: wget
>>    http://cran.r-project.org/src/base/R-3/R-3.1.3.tar.gz tar -xzf
>> R-3.1.3.tar.gz mv R-3.1.3 R-3.1.3-source
>>    mkdir R-3.1.3-build cd R-3.1.3-build ../R-3.1.3-source/configure # we do
>>    ./configure *outside* the source directory (=> keep sources)
>>    make make check make pdf make info
>>    cd ..  ln -s /usr/local/R/R-3.1.3-build/bin/R /usr/local/R/R
>>    mkdir /usr/local/R/library # create version-independent library
>>    sudo emacs ~/etc/bash.bashrc # then add: PATH=/usr/local/R:$PATH
>> 4) ~/.Renviron should contain R_LIBS=/usr/local/R/library
>> Thanks & cheers,
>> Marius
>> On Mon, Mar 30, 2015 at 1:09 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>> > Marius,
>> >
>> > On 30 March 2015 at 12:30, Marius Hofert wrote:
>> > | Here is how I installed R. This is basically how Martin Maechler
>> > | showed me to install R under Ubuntu (in several versions so that they
>> > | are also recognized by ESS). My goal is to adjust this to make it work
>> >
>> > | for Debian:
>> > That's your beef.  We support reasonably feature complete packages built
>> > in
>> > reasonably well-engineered and by now mostly debugged processes.
>> >
>> > You can of course build your own, but if you do and things break you get
>> > to
>> > keep those pieces.
>> >
>> > And how to build R(-devel) locally has been discussed in the past.
>> >
>> > Dirk
>> >
>> > --
>> > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>> _______________________________________________
>> R-SIG-Debian mailing list
>> R-SIG-Debian at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-debian
> --
> PD Dr. Johannes Ranke
> Kronacher Str. 8
> 79639 Grenzach-Wyhlen

More information about the R-SIG-Debian mailing list