trouble loading ggplot2 in R - r

I'm having trouble loading ggplot2 using R version 2.12.1, as shown below. The only help I can find suggests loading "proto". I tried that and it didn't fix my problem. Any help would be very much appreciated. Thanks,
peter l
> install.packages('ggplot2', dep = TRUE)
trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/leopard/contrib/2.12/ggplot2_0.8.9.tgz'
Content type 'application/x-gzip' length 2481399 bytes (2.4 Mb)
opened URL
=================================================
downloaded 2.4 Mb
The downloaded packages are in
/var/folders/XF/XF0tU7gdGTeF4Th7KhKYDk+++TI/-Tmp-//RtmpFMnqLB/downloaded_packages
> library(ggplot2)
Error in assign(names[i], dots[[i]], env = envir) :
invalid first argument
Error : unable to load R code in package 'ggplot2'
Error: package/namespace load failed for 'ggplot2'

Hmmm, have you omitted some lines there, before the The downloaded packages are in....? I get:
> install.packages('ggplot2', dep = TRUE)
Installing package(s) into ‘/home/gavin/R/libs’
(as ‘lib’ is unspecified)
trying URL 'http://cran.uk.r-project.org/src/contrib/ggplot2_0.8.9.tar.gz'
Content type 'application/x-gzip' length 2074749 bytes (2.0 Mb)
o pened URL
==================================================
downloaded 2.0 Mb
* installing *source* package ‘ggplot2’ ...
** R
** data
** moving datasets to lazyload DB
** inst
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (ggplot2)
The downloaded packages are in
‘/tmp/RtmpfDSoM8/downloaded_packages’
> require(ggplot2)
Loading required package: ggplot2
Loading required package: reshape
Loading required package: plyr
Attaching package: 'reshape'
The following object(s) are masked from 'package:plyr':
round_any
Loading required package: grid
Loading required package: proto
Do you also see the * Done (ggplot2) message for example? If not, the installation likely failed for some reason and we need more details in order to help.
The above was on
> sessionInfo()
R version 2.12.1 Patched (2011-02-06 r54249)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C
[3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8
[5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8
[7] LC_PAPER=en_GB.utf8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets
[7] methods base
other attached packages:
[1] ggplot2_0.8.9 proto_0.3-8 reshape_0.8.4 plyr_1.4
loaded via a namespace (and not attached):
[1] tools_2.12.1

Related

R - New libraries fail to install even though dependencies are there

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.

AnnotationHub installation ‘Rcpp’ 1.0.6 is already loaded, but >= 1.0.7 is required [duplicate]

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.

Unexpected behavior of R when trying to install dplyr

I am trying to update the dplyr package to resolve a problem with rlang, following relevant advice in the web.
First I removed the previous installation of dplyr with the remove.packages() command.
Then I restarted R Studio.
Here is the remaining of the story:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
[...]
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RevoUtilsMath_10.0.0 RevoUtils_10.0.5 RevoMods_11.0.0 MicrosoftML_1.5.0 mrsdeploy_1.1.2
[6] RevoScaleR_9.2.1 lattice_0.20-35 rpart_4.1-11
loaded via a namespace (and not attached):
[1] codetools_0.2-15 CompatibilityAPI_1.1.0 foreach_1.4.4 grid_3.4.1 R6_2.2.2
[6] jsonlite_1.5 curl_2.6 iterators_1.0.8 tools_3.4.1 yaml_2.1.14
[11] compiler_3.4.1 mrupdate_1.0.1
> library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’
> install.packages('dplyr', dependencies = TRUE)
Installing package into ‘C:/Users/Alienware/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://mran.microsoft.com/snapshot/2017-09-01/bin/windows/contrib/3.4/dplyr_0.7.2.zip'
Content type 'application/zip' length 2881528 bytes (2.7 MB)
downloaded 2.7 MB
package ‘dplyr’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘dplyr’
The downloaded binary packages are in
C:\Users\Alienware\AppData\Local\Temp\RtmpucBaSk\downloaded_packages
> library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’
Go to your R library path (where your packages are stored):
C:\Users\username\Documents\R\win-library\3.5
You can refer to this guide on how to find your R library path.
Next, simply search for dplyr in your folder and delete it. I find that this manual method works for me as opposed to removing packaging via Rstudio. Hope it helps!

Error while installing any package in R

I am trying to install matrixStats package in R. The command I have used is:
install.packages("matrixStas", dependencies = TRUE)
This command produces the following error:
* installing *source* package ‘colorspace’ ...
** package ‘colorspace’ successfully unpacked and MD5 sums checked
** libs
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘colorspace’ in
library.dynam(lib, package, package.lib):shared object ‘colorspace.so’
not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/colorspace’
I have tried uninstalling and reinstalling R (twice),Updating packages,tried installing the packages from linux commandline as well. Then I installed Rstudio and tried installing packages using that which in turn gave the same problem. Nothing seems to help. I have tried installing other packages as well and they all end up showing the same error.
I am using R version 3.4.2
sessionInfo:
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-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=en_IN LC_NUMERIC=C LC_TIME=en_IN
[4] LC_COLLATE=en_IN LC_MONETARY=en_IN LC_MESSAGES=en_IN
[7] LC_PAPER=en_IN LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_IN LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2
Any suggestions from your end would be a great help for me

Error installing R (3.1.0) package caret on Ubuntu 14.04.1 LTS

Trying to install package "caret" on R 3.1.0 (Ubuntu 14.04.01 LTS) and running into a build error.
> install.packages('caret')
[...]
* installing *source* package ‘BradleyTerry2’ ...
** package ‘BradleyTerry2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : object ‘brglm’ is not exported by 'namespace:brglm'
ERROR: lazy loading failed for package ‘BradleyTerry2’
* removing ‘/home/br00t/R/x86_64-pc-linux-gnu-library/3.1/BradleyTerry2’
Warning in install.packages :
installation of package ‘BradleyTerry2’ had non-zero exit status
ERROR: dependency ‘BradleyTerry2’ is not available for package ‘caret’
* removing ‘/home/br00t/R/x86_64-pc-linux-gnu-library/3.1/caret’
Warning in install.packages :
installation of package ‘caret’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp7pWmvr/downloaded_packages’
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8 LC_PAPER=en_CA.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sp_1.0-16
loaded via a namespace (and not attached):
[1] grid_3.1.0 lattice_0.20-29 tools_3.1.0
Wasn't able to find anything helpful on the interwebs. Not sure if this is an issue with the BradleyTerry2 package or brglm... help?
Thanks,
br00t
If you are running a version of the brglm package greater than 0.5-9, uninstall and install brglm package version 0.5-9
I was able to get over the issue too by installing the dependencies. You may want to select your answer as the right one.

Resources