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

Dirk Eddelbuettel edd at debian.org
Wed Feb 10 17:18:51 CET 2016


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
 
| _______________________________________________
| R-SIG-Debian mailing list
| R-SIG-Debian at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



More information about the R-SIG-Debian mailing list