0

I have a large data sets stored on a server and need it analysed using R. I don't have permissions to change or install packages to the already available R, so I've designated a folder in my personal server storage, "/R_packages" where I can deposit packages my R script relies on. For some packages, the formula

> if (!require("devtools")) install.packages("devtools", repos = "http://cran.us.r-project.org", lib="/loc/R_packages")

works. However, I'm not sure I am doing it right specifying the repository for bioconductor packages (I need to use rtracklayer::import() ) and where to deposit libraries. The .Rout file stores this output:

> if (!require("BiocManager", quietly = TRUE))
+     install.packages("BiocManager",lib="/loc/R_packages")
Error in contrib.url(repos, type) : 
  trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'BiocManager'
Execution halted
tail: mainScript.Rout: file truncated
trying URL 'http://cran.us.r-project.org/src/contrib/BiocManager_1.30.18.tar.gz'
Content type 'application/x-gzip' length 289602 bytes (282 KB)
==================================================
downloaded 282 KB

During startup - Warning message:
Setting LC_CTYPE failed, using "C" 
* installing *source* package 'BiocManager' ...
** package 'BiocManager' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package 'BiocManager'
    finding HTML links ... done
    BiocManager-pkg                         html  
    available                               html  
    install                                 html  
    repositories                            html  
    valid                                   html  
    version                                 html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
During startup - Warning message:
Setting LC_CTYPE failed, using "C" 
* DONE (BiocManager)

The downloaded source packages are in
    '/var/tmp/pbs.9977839.bias5-adm/RtmpB7VvjD/downloaded_packages'
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'BiocManager'
> BiocManager::install()
Error in loadNamespace(name) : there is no package called 'BiocManager'
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
^C
(base) [devil@bias5-login R_Analysis]$ less mainScript.Rout 

** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package 'BiocManager'
    finding HTML links ... done
    BiocManager-pkg                         html  
    available                               html  
    install                                 html  
    repositories                            html  
    valid                                   html  
    version                                 html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
During startup - Warning message:
Setting LC_CTYPE failed, using "C" 
* DONE (BiocManager)

The downloaded source packages are in
        '/var/tmp/pbs.9977839.bias5-adm/RtmpB7VvjD/downloaded_packages'
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'BiocManager'
> BiocManager::install()
Error in loadNamespace(name) : there is no package called 'BiocManager'
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
rdv
  • 41
  • 4
  • 1
    I suspect you need to add your new package library location using `.libPaths()`. From the number of upvotes on this answer I'm guessing that this is a fairly common stumbling block: https://stackoverflow.com/questions/15170399/change-r-default-library-path-using-libpaths-in-rprofile-site-fails-to-work/15170774#15170774 – IRTFM Sep 26 '22 at 06:11
  • @rdv: see an example on here https://hpc.wsu.edu/programmers-guide/running_r/ – Tung Sep 26 '22 at 06:35
  • 1
    Thank you. Your advice lead me to a solution. First I added an extra path to my local personal library: ```>myLibPaths <- c(.libPaths(),"/loc/R_packages/") > .libPaths(myLibPaths)``` I still couldn't install Bioconductor: this was due to the default R version being outdated. So I modified the PBS shell: ```module load R/R-3.5.0 R CMD BATCH mainScript.R``` I could install and use `rtracklayer`. Thanks for the help – rdv Sep 27 '22 at 05:54

0 Answers0