I have a rather interesting problem that I cannot find the answer to. I am using a RStudio Server (v. 1.4.1717), and R version 4.1.0 is installed. I try to use Projects with renv and so far it had been quite okay, even though I had problems with occasional library installations.
However, right now I keep getting this error:
Error: package ‘xxx’ required by ‘yyy’ could not be found
I have tried couple of things. I tried changing .libPaths()
to a new location, have a fresh installation of each library, but it didn't solve my issue. I also tried doing this inside and outside a project (so, also renv active and disabled) but I keep getting same problem. Just to give an example:
>BiocManager::install("MatrixGenerics", lib = "/media/erkin/lib")
getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
replacement repositories:
CRAN: https://packagemanager.rstudio.com/all/__linux__/focal/latest
Bioconductor version 3.14 (BiocManager 1.30.18), R 4.1.0 (2021-05-18)
Installing package(s) 'MatrixGenerics'
trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/MatrixGenerics_1.6.0.tar.gz'
Content type 'application/x-gzip' length 28270 bytes (27 KB)
==================================================
downloaded 27 KB
* installing *source* package ‘MatrixGenerics’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package ‘matrixStats’ required by ‘MatrixGenerics’ could not be found
Execution halted
ERROR: lazy loading failed for package ‘MatrixGenerics’
* removing ‘/media/erkin/lib/MatrixGenerics’
The downloaded source packages are in
‘/tmp/RtmpgabWCB/downloaded_packages’
Warning message:
In install.packages(...) :
installation of package ‘MatrixGenerics’ had non-zero exit status
I have matrixStats
installed, and I can call it. If I check sessionInfo()
:
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS
Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] matrixStats_0.62.0 BiocGenerics_0.40.0
loaded via a namespace (and not attached):
[1] BiocManager_1.30.18 compiler_4.1.0 tools_4.1.0
This is not the only package this happens with. Many of the other packages I tried to install (e.g. S4Vectors
installation cannot find BiocGenerics
, BiocStyle
installation says no package called BiocManager
) just keeps failing.
I am probably missing something, does anybody have an idea why I my R fails to find the installed packages to install new packages?
I solved the issue by removing .Rprofile.
If you have an .Rprofile file and you set the library there, using renv "confuses" the main library path. I think it ends up checking the path .Rprofile shows, even though all the other commands (.libPaths()
, find.package()
) show renv library path. Removing the .Rprofile removed all the issues for me.