[R-sig-Debian] Change Rscript and `/usr/lib/R/bin/R` relation

Alexey Zaharov alexey.a.zaharov at gmail.com
Fri Feb 12 16:11:35 CET 2016


On Wed, 10 Feb 2016 10:18:51 -0600, Dirk Eddelbuettel wrote:

> Thanks for bringing the question over from StackOverflow [1].  I am not
> very impressed that you STILL hide behind a pseudonym and I am starting
> to question my sanity as to why I take time out to help someone like
> that. Anyway, read on ...
> 
> [1] http://stackoverflow.com/questions/35313704/rscript-launch-custom-r/
> 
> On 10 February 2016 at 15:50, Cron Acronis wrote:
> | Dear all,
> |
> | I am trying to use multiple version of R unpacked from CRAN deb files.
> 
> That will not work "as is". They have their path baked in.
> 
> You could expand them into a Docker container each, and invoke those.
> 
> You _could_ try re-setting RHOME, R_HOME, ...   But rest assured that
> you attempt to deploy R in a way NOT foreseen or designed by the
> authors.
> 
> | It does work successfully, except for some packages installation,
> whether | Rscript has been used. I have configured alternatives and
> switch R | environments without any problem and can install most of the
> packages.
> |
> | '======================================================
> | $ update-alternatives --display R | R - auto mode |   link currently
> points to /opt/R/3.2.3/usr/lib/R/bin/R | /opt/R/3.2.3/usr/lib/R/bin/R -
> priority 200 | /usr/lib/R/bin/R - priority 100 | Current 'best' version
> is '/opt/R/3.2.3/usr/lib/R/bin/R'.
> |
> |
> | $ update-alternatives --display Rscript | Rscript - auto mode |   link
> currently points to /opt/R/3.2.3/usr/lib/R/bin/Rscript |
> /opt/R/3.2.3/usr/lib/R/bin/Rscript - priority 200 |
> /usr/lib/R/bin/Rscript - priority 100 | Current 'best' version is
> '/opt/R/3.2.3/usr/lib/R/bin/Rscript'.
> | '======================================================
> |
> | Rscript always invokes `/usr/lib/R/bin/R`, but my alternatives are |
> configured against `/usr/bin/R`
> |
> | '======================================================
> | $ Rscript --verbose -e 'Sys.getenv("R_HOME")'
> | running |   '/usr/lib/R/bin/R --slave --no-restore -e
> Sys.getenv("R_HOME")'
> |
> | [1] "/usr/lib/R"
> | '======================================================
> |
> | As have been mentioned by Dirk Eddelbuettel, in order to make Rscript
> | invoke correct R, I can adjust `PATH` environment variable.
> 
> That presumed a local build into the location where PATH finds it. That
> is how some R Core members use different versions, and that approach
> 'was good enough for me' too.   You are overcomplicating things here and
> get to pick up the pieces.
> 
> | Which was done, but in my case didn't work out. Rscript still calls
> `/usr/ | lib/R/bin/R`
> |
> | '======================================================
> | $ env | grep PATH |
> PATH=/opt/R/3.2.3/usr/lib/R/bin:/opt/python/conda/bin::/usr/local/sbin:/
> |
> usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
> |
> |
> | $ Rscript --version && Rscript --verbose -e 'print("Hello")'
> |     R scripting front-end version 3.2.3 (2015-12-10)
> |     running |       '/usr/lib/R/bin/R --slave --no-restore -e
> print("Hello")'
> |
> |     [1] "Hello"
> | '======================================================
> |
> |
> | Could you please advise where I should dig further in order to force |
> Rscript to use `/usr/bin/R` or `/opt/R/3.2.3/usr/lib/R/bin/R`?
> 
> Build from source into the chosen location.
>  
> | Regards, Cron Acronis.
> 
> In the future, use a real name if you want real help from real people.
> 
> Dirk
>  

Dear Dirk,

Probably you would like to know, that I have managed to solve the problem 
by using `schroot`.

It can attach current user `home` folder to `rootfs` from `chroot` where.

After I have configured the `trusty64`, I have just created a clone.
Inside the clone I have installed another version of R from CRAN repo.
<--------------------------------START------------->
root at chroot-test:/# schroot -l
chroot:trusty64
chroot:trusty64_clone


$ cat /etc/schroot/chroot.d/trusty64.conf 
[trusty64]
description=Ubuntu 14.04 Trusty Tahr
directory=/test/schroot/trusty64
users=quant
type=directory
profile=desktop
#personality=linux
preserve-environment=true
root-groups=root

$ cat /etc/schroot/chroot.d/trusty64_clone.conf 
[trusty64_clone]
description=Ubuntu 14.04 Trusty Tahr
directory=/test/schroot/trusty64
users=quant
type=directory
profile=desktop
#personality=linux
preserve-environment=true
root-groups=root

root at chroot-test:/etc# debootstrap --variant=minbase --arch amd64 trusty /
test/schroot/trusty64/ http://archive.ubuntu.com/ubuntu/


root at chroot-test:/etc# schroot -c trusty64 -u quant
root at chroot-test:/etc# schroot -c trusty64_clone -u quant
<--------------------------------END--------------->

-- 
Regards. Alexey.



More information about the R-SIG-Debian mailing list