Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Bioconductor packages without root privileges?

Tags:

linux

r

I need to use BiomaRt, preferrably the version in the 3.1 release. See: http://www.ensembl.info/blog/2015/06/01/biomart-or-how-to-access-the-ensembl-data-from-r/

I tried to follow the installation instruction in the aformentioned page to run the program in a Linux-based server. Also, I tried this one: http://www.bioconductor.org/install/#install-R, but, unless root permission is given, they won't work. I have loaded other packages using this approach https://linuxishbell.wordpress.com/2010/12/10/install-r-package-without-root-accesson-linux/, but they seem unfited for my case. What is the most recommendable thing to do? I have searched the internet, but little advice by Bioconductor team and user is provided in such case.

like image 240
je_b Avatar asked Oct 20 '22 10:10

je_b


2 Answers

You do not need to install R from the scratch to install packages without root privilege. Try this way:

module load R

(say this is the R on the cluster, so now it is on your path and you can enter it by typing R)

export R_LIBS_USER=$HOME/apps/R:$R_LIBS_USER

(you are still on the Linux commandline, not in R yet)

R

(now you enter R)

install.packages("packagename")

Well done, it will install the package to HOME/apps/R

library(packagename)

(Try it and see it worked)

like image 161
FatihSarigol Avatar answered Oct 22 '22 01:10

FatihSarigol


Solution

The easiest way to do this is to install R from source:

$ wget http://cran.rstudio.com/src/base/R-3/R-3.1.1.tar.gz
$ tar xvf R-3.1.1.tar.gz
$ cd R-3.1.1
$ ./configure --prefix=$HOME/R
$ make && make install

The second-to-last step is the critical one. It configures R to be installed into a subdirectory of your own home directory.

To run it on Linux and similar systems, add $HOME/R/bin to your PATH. Then, commands like R and Rscript will work.

On OS X, the bin dir is buried in $HOME/R/R.framework/Versions/Current/Resources instead, due to the way OS X packaging works.

You can give --prefix=$HOME instead if you don't wish to have R and all its dependencies hidden in its own subdirectory. If you are on Linux and have $HOME/bin in your PATH already, doing so would avoid the need to edit the PATH. The downside is that it makes later uninstallation harder, since R would be intermingled among your other $HOME contents.

This general pattern applies to a large amount of Unix software you can install from source code. If the software has a configure script, it probably understands the --prefix option, and if not, there is usually some alternative with the same effect.

These features are common for a number of reasons. Your case — where you can't get root to install the software into a typical location so you install into $HOME instead — is actually one of the least common uses for this sort of feature. Here are some more common use cases:

  • Circumstances may dictate a better location than the standard default (/usr/local) such as /usr, /opt/$PKGNAME, etc.

  • Binary package building systems (RPM, DEB, PKG, Cygport...) typically build and install the package into a special staging directory, then pack that up in such a way that it expands into the desired installation location.

Have a look at those links

https://unix.stackexchange.com/questions/149451/install-r-in-my-own-directory http://onertipaday.blogspot.be/2008/04/r-installing-on-unixlinux-no-root.html

Otherwise

You could may be use a virtual appliance, to install the app virtually with virtual root access

like image 43
intika Avatar answered Oct 22 '22 00:10

intika