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.
Related
This question already has an answer here:
how to update R Rcpp to versions > 1.7
(1 answer)
Closed 11 months ago.
I am currently trying to install AnnotationHub but I am running into problems. I use R 4.0.4, renv (version 0.15.4) and BiocVersion 3.12.
When I run BiocManager::install("AnnotationHub"), I get the following error:
Warning message:
This project is configured to use R version '4.1.1', but '4.0.4' is currently being used.
* installing *source* package ‘AnnotationHub’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
Error: package or namespace load failed for ‘AnnotationHub’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘Rcpp’ 1.0.6 is already loaded, but >= 1.0.7 is required
Error: loading failed
Execution halted
My .libPaths() look something like this:
[1] "/test_renv/renv/library/R-4.0/x86_64-pc-linux-gnu"
[2] "/usr/prog/R/4.0.4/lib64/R/library"
I thought that the error message was very straight forward and reinstalled Rcpp (install.packages("Rcpp")). Then I ran packageVersion("Rcpp") which returned 1.0.8.3.
I restarted my R session and reran BiocManager::install("AnnotationHub"), but the exact same error message occured. Also if I run library(Rcpp) before installing AnnotationHub.
When I run sessionInfo() after restart, it looks like this:
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /usr/prog/OpenBLAS/0.2.20-GCC-6.4.0-2.28/lib/libopenblas_haswellp-r0.2.20.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.4 tools_4.0.4 renv_0.15.4
I would greatly appreciated any insights, why this might occur and how I can fix it.
(I have also posted the issue on StackOverflow, because I think that this is not necessary a Bioconductor related problem)
The error message is very straightforward, yes, and your solution goes in the right direction. But you apparently have a mix here between an renv environment and your usage of the standard install.packages and BiocManager::install. If you need an environment with specific versions, then stick to renv::install and so on to set a proper lock file. Trying to use install.packages is pointless if the lock file is enforcing an old version (of Rcpp and/or other packages). Otherwise, just remove the lock file or disable the environment.
I am pretty desperate to install.packages("devtools").
However it allways fails with this error
Error: .onLoad failed in loadNamespace() for 'pkgload', details:
call: readRDS(nsInfoFilePath)
error: error reading from connection
Execution halted
ERROR: lazy loading failed for package ‘devtools’
* removing ‘/home/bjoern/R/x86_64-pc-linux-gnu-library/3.6/devtools’
Things I tried to fix this:
Add the dependencies = T argument
Following a suggestion by hadley wickham on github -> update rlang package
Try to run install.packages("pkgload") resulting in nearly exactly the same error (see below)
Completely removing R and reinstalling it
Additionally installing package following packages:
r-base-dev
r-cran-devtools
r-recommended
Updated all packages update.packages(ask = FALSE, checkBuilt = TRUE)
Error of install.packages("pkgload")
Error: package or namespace load failed for ‘pkgload’:
.onLoad failed in loadNamespace() for 'pkgload', details:
call: readRDS(nsInfoFilePath)
error: error reading from connection
Error: loading failed
Execution halted
ERROR: loading failed
I digged even deeper to the pkgload (which at least I hope is the only reason for the problem). I will check if manually (re)installing all imports and suggests from the CRAN page of pkgload does solve it.
Imports: desc, methods, pkgbuild, rlang, rprojroot, rstudioapi,
utils, withr Suggests: bitops, covr, Rcpp, testthat
My sessionInfo() output:
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3
I still refuse to belief that it is impossibe to install devtools on ubuntu20
However at this point I take any straw
Solution Edit:
In short what fixed the issue for me was installing testthat package before. Thanks to comment by rui-barradas
install.packages("testthat")
install.packages("pkgload")
install.packages("devtools")
I am also on Ubuntu 20.04 but running R 4.0.0.
When trying to install a package, if it depends on another that was installed prior to R 4.0.0 I get an error message and the installation fails. This happens even if I set dependencies = TRUE in the call to install.packages.
Example: The command was
install.packages('pkgload')
I omit the first output lines, saying that the file was downloaded. Then, the relevant part.
installing source package ‘pkgload’ ...
** package ‘rcmdcheck’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading Error: package ‘testthat’ was installed before R 4.0.0: please re-install it
Execution halted ERROR: lazy loading failed for package ‘pkgload’
removing ‘/usr/local/lib/R/site-library/pkgload’
restoring previous ‘/usr/local/lib/R/site-library/pkgload’ Warning in install.packages : installation of package ‘pkgload’ had
non-zero exit status The downloaded source packages are in
‘/tmp/RtmpVxpbs0/downloaded_packages’
Correct way.
The right way of installing package pkgload was to run the sequence
install.packages('testthat')
install.packages('pkgload')
and the problem was solved.
Note that with other packages, it already happened to see this be a recursive issue. Imagine that package testthat depended (which it does not) on another package installed prior to R 4.0.0.
Annoying but solvable.
sessionInfo()
#R version 4.0.0 (2020-04-24)
#Platform: x86_64-pc-linux-gnu (64-bit)
#Running under: Ubuntu 20.04 LTS
#
#Matrix products: default
#BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
#LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
#
#locale:
# [1] LC_CTYPE=pt_PT.UTF-8 LC_NUMERIC=C
#[3] LC_TIME=pt_PT.UTF-8 LC_COLLATE=pt_PT.UTF-8
# [5] LC_MONETARY=pt_PT.UTF-8 LC_MESSAGES=pt_PT.UTF-8
# [7] LC_PAPER=pt_PT.UTF-8 LC_NAME=C
# [9] LC_ADDRESS=C LC_TELEPHONE=C
#[11] LC_MEASUREMENT=pt_PT.UTF-8 LC_IDENTIFICATION=C
#
#attached base packages:
#[1] stats graphics grDevices utils datasets
#[6] methods base
#
#other attached packages:
#[1] rvest_0.3.5 xml2_1.3.2 data.table_1.12.8
#
#loaded via a namespace (and not attached):
I had the same problems, and the solution was, at least in my case, Ubuntu 20.04.1 LTS (Focal Fossa) + R 4.0.2:
First (from terminal), install:
Step 1: sudo apt-get update -y
Step 2: sudo apt-get install -y libxml2-dev
Then from RStudio (setRepositories first, and choose 8 repositories) and install both packages:
Install xml2 package
install devtools
And works for me.
Have read and tried various solutions to what sound like similar problems including:
Cannot install RStudio on CentOS 6.4
installing package "sjstats" gives error non-zero exit status
Unable to install sandwich package: installation of package ‘sandwich’ had non-zero exit status
installation of package ‘recharts’ had non-zero exit status
I've installed RStudio on Linux Centos7.
I downloaded and installed both R and Rstudio as root user. After opening port 8787 I was able to visit the application in my browser and reach the login page. RStudio would not allow me to login with the root user so I created a new user 'rstudio' in the terminal sudo adduser rstudio, created a password for rstudio user and then was able to login.
R works till this point. I am able to use base R, save scripts etc all within Linux CentOs hosted RStudio within my browser.
However, when I try to install any package, I receive an error message e.g.
Warning in install.packages :
installation of package ‘covr’ had non-zero exit status
This happens for every and any package that I try to install.
I tried changing permissions to 777 on R directory within /home/rstudio/R. I did this as the original root user who downlaoded and installed R and RStudio, not as the new end user "rstudio".
This did not solve my problem.
I tried adding dependencies = T to all of my calls to install.packages() however that did not make a difference.
I suspect that it's a permissions issue. However, I also tried to install packages from within R on the command line and could not, even when I was SSHd in as root.
Not sure what other information to provide.
How can I install packages and overcome 'non zero exit status' from within my instance of Hosted RStudio?
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0 yaml_2.2.0
When installing rJava, the install completes successfully, but there are loads and loads of warnings in the process. This is the first one:
jri_glue.c: In function ‘PushToREXP’:
jri_glue.c:24:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
jpar[1].j = (jlong) robj;
^
jri_glue.c: In function ‘RReleaseREXP’:
jri_glue.c:52:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
SEXP x = (SEXP) r;
^
This is the second block of warnings:
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
Here are the first lines of the third block of warnings, which in total contains almost 500 lines:
In file included from Rengine.c:4:0:
Rengine.c: In function ‘Java_org_rosuda_JRI_Rengine_rniParse’:
jri.h:21:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
#define SEXP2L(s) ((jlong)(s))
^
Rengine.c:121:14: note: in expansion of macro ‘SEXP2L’
return SEXP2L(pstr);
^
The reason why I think there is a problem is the following: When I try to install another package that depends on rJava, namely XLConnectJars, I get a segmentation fault:
> install.packages("XLConnectJars")
[...]
* installing *source* package ‘XLConnectJars’ ...
** Paket ‘XLConnectJars’ erfolgreich entpackt und MD5 Summen überprüft
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Segmentation fault (core dumped)
ERROR: loading failed
Why is this happening, what can I do about this?
In June / July 2017, similar problems appeared after the update to kernel 4.4.0-81-generic, but the kernel has since been patched:
https://github.com/miraisolutions/xlconnect/issues/70
(My current kernel is 4.10.0-35-generic.)
Also, the suggested workarounds there and in related threads (like increasing the thread stack size using the -Xss2048k option) do not work on my machine.
Installing rJava via sudo apt-get install r-cran-rjava as suggested in numerous places did not help, either.
My java version is
~$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK Server VM (build 25.131-b11, mixed mode)
and sessionInfo() returns
R version 3.4.2 (2017-09-28)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8
[4] LC_COLLATE=de_DE.UTF-8 LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rJava_0.9-8
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2
Thanks for any help.
I would like to install the package GeoXp, but R doesn't let me...see the error below...
>install.packages("GeoXp")
...
configure: using libpng dynamic linkage
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/****/R/x86_64-pc-linux-gnu-library/3.0/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
ERROR: dependency ‘rgl’ is not available for package ‘GeoXp’
* removing ‘/home/******/R/x86_64-pc-linux-gnu-library/3.0/GeoXp’
Warning in install.packages :
installation of package ‘GeoXp’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpAbblyJ/downloaded_packages’
> library("GeoXp")
Error in library("GeoXp") : there is no package called ‘GeoXp’
Well, there seems to be a problem with the dependencies...but installing rgl does not work either...
Here my session info:
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C
LC_ADDRESS=C LC_TELEPHONE=C
LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
base
other attached packages:
[1] spacetime_1.1-3 sp_1.0-17
loaded via a namespace (and not attached):
[1] grid_3.0.2 intervals_0.15.0 lattice_0.20-29
tools_3.0.2 xts_0.9-7 zoo_1.7-11
What can I do?
GeoXp has a dependency on rgl, tries to install that first, but fails there. rgl needs to have the X11 development libraries, as well as the (open source) OpenGL development and run-time libraries (mesa). For Ubuntu, you need to install the system packages libgl1-mesa-dev and libglu1-mesa-dev first (with apt-get or sth similar), then install in R package rgl, then GeoXp.
I think the problem is that you have to install X library and gl
Ops, sorry #Pascal, I did not see your comment.