Error installing ggplot2 - r

I was trying to run a simple code on ggplot2 and got the following error:
source("u1.txt")
Error in library(ggplot2) : there is no package called ‘ggplot2’
Error : package ‘foreign’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘maptools’
* removing ‘/home/shivangi/R/i686-pc-linux-gnu-library/3.0/maptools’
* installing *source* package ‘multcomp’ ...
** package ‘multcomp’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (multcomp)
ERROR: dependencies ‘plyr’, ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
* removing ‘/home/shivangi/R/i686-pc-linux-gnu-library/3.0/ggplot2’
The downloaded source packages are in
‘/tmp/RtmpOGWrr4/downloaded_packages’
Warning messages:
1: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘plyr’ had non-zero exit status
3: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘testthat’ had non-zero exit status
4: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘reshape2’ had non-zero exit status
5: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘scales’ had non-zero exit status
6: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘Hmisc’ had non-zero exit status
7: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘maptools’ had non-zero exit status
8: In install.packages("ggplot2", dep = TRUE) :
installation of package ‘ggplot2’ had non-zero exit status

I had the same error running ggplot this evening, essentially you need to try to install all the dependencies that failed. For me it was "scales", then "munsell" and then finally (the actual problem) "colorspace" which hadn't be updated since I upgraded to 3.1.1. In your case, it looks like you want to first try installing "foreign" and then try ggplot2 again. Keep loading dependencies that error manually until you find the real problem.

You can specify that the install.packages() call also install all dependent packages:
if(!require(ggplot2)) install.packages('dplyr',dependencies = TRUE)
the above code first checks to see if ggplot2 package is loaded, if not it tries to load the apckage. If it cannot load the package, it then tries to install the package and all of package its dependencies.

With RTools installed, I got this to work:
install.packages("ggplot2", type="source",dependencies = TRUE)
Compiled a few packages...
Make sure your PATH is updated to point to RTools properly, i.e. includes
c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin
at the front.
I am using Rtools32.exe

Related

Installing shiny on AWS EC2 ubuntu 20.4 fail

I keep struggling installing shiny on a ubuntu 20.4 vm on EC2.
I followed this procedure.
Then I tried:
install.packages("shiny")
install.packages("shiny", dependencies = T)
install.packages("shiny", dependencies = T, INSTALL_opts ='--no-lock')
I also add 4GB of SWAP memory.
But no way...
Here are my outputs:
** R
** demo
** byte-compile and prepare package for lazy loading Error: package ‘promises’ was installed before R 4.0.0: please re-install it
Execution halted ERROR: lazy loading failed for package ‘httpuv’
removing ‘/usr/local/lib/R/site-library/httpuv’ ERROR: dependency ‘openssl’ is not available for package ‘httr’
removing ‘/usr/local/lib/R/site-library/httr’ ERROR: dependency ‘textshaping’ is not available for package ‘ragg’
removing ‘/usr/local/lib/R/site-library/ragg’ ERROR: dependency ‘httpuv’ is not available for package ‘shiny’
removing ‘/usr/local/lib/R/site-library/shiny’ ERROR: dependency ‘httr’ is not available for package ‘webdriver’
removing ‘/usr/local/lib/R/site-library/webdriver’ ERROR: dependencies ‘httr’, ‘shiny’, ‘webdriver’, ‘httpuv’ are not available
for package ‘shinytest’
removing ‘/usr/local/lib/R/site-library/shinytest’
The downloaded source packages are in
‘/tmp/RtmpGvP9AB/downloaded_packages’ Warning messages: 1: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘openssl’ had non-zero exit status 2: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘textshaping’ had non-zero exit status 3: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘httpuv’ had non-zero exit status 4: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘httr’ had non-zero exit status 5: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘ragg’ had non-zero exit status 6: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘shiny’ had non-zero exit status 7: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘webdriver’ had non-zero exit status 8: In
install.packages("shiny", dependencies = TRUE) : installation of
package ‘shinytest’ had non-zero exit status
Each time I try to install a dependency "by hand", an other missing one, deeper nested, shows up.
Could someone help me with this, please ?
Not sure if you were able to solve your issues. Recently I also faced similar issues in trying to install Shiny server and related packages in EC2. I researched a bit and came across a Rstudio server AMI (Amazon Machine Image)- https://www.louisaslett.com/RStudio_AMI/, maintained by Louis Aslett. You can choose the AMI from the nearest region and once the instance is up and running, you can directly start using R-studio or Shiny. I find it very helpful.
To install openssl R package, you'll also need system-wide installation of the samename package. You could try something like sudo apt-get install openssl. Search the internet for dependencies of other packages.

Installing factoextra package in R

I am using R version >3.5. I want to install factoextra package on R studio (I use Mac). I tried to install the package directly with dependencies = TRUE, and I also tried to install the dependencies packages one by one. Neither worked.
Here is the error message: (* represents the user on my computer).
* installing *source* package ‘quantreg’ ...
** package ‘quantreg’ successfully unpacked and MD5 sums checked
** libs
/Users/*/.R/Makevars:2: *** missing separator. Stop.
ERROR: compilation failed for package ‘quantreg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/quantreg’
* installing *source* package ‘mclust’ ...
** package ‘mclust’ successfully unpacked and MD5 sums checked
** libs
/Users/*/.R/Makevars:2: *** missing separator. Stop.
ERROR: compilation failed for package ‘mclust’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mclust’
ERROR: dependencies ‘pbkrtest’, ‘quantreg’ are not available for package ‘car’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/car’
ERROR: dependency ‘car’ is not available for package ‘rstatix’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstatix’
ERROR: dependency ‘rstatix’ is not available for package ‘ggpubr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/ggpubr’
ERROR: dependency ‘ggpubr’ is not available for package ‘factoextra’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/factoextra’
The downloaded source packages are in:
‘/private/var/folders/8v/mfj4t9t54y72cdrz6q84jnjh0000gn/T/RtmpfEwO54/downloaded_packages’
Warning messages:
1: In install.packages("factoextra", dependencies = TRUE) :
installation of package ‘quantreg’ had non-zero exit status
2: In install.packages("factoextra", dependencies = TRUE) :
installation of package ‘mclust’ had non-zero exit status
3: In install.packages("factoextra", dependencies = TRUE) :
installation of package ‘car’ had non-zero exit status
4: In install.packages("factoextra", dependencies = TRUE) :
installation of package ‘rstatix’ had non-zero exit status
5: In install.packages("factoextra", dependencies = TRUE) :
installation of package ‘ggpubr’ had non-zero exit status
6: In install.packages("factoextra", dependencies = TRUE) :
installation of package ‘factoextra’ had non-zero exit status
any help would be greatly appreciated!!
R packages come in two shapes: as pre-compiled binaries, and as source code. In your case, it seems that the compilation of mclust and quantreg failed, as suggested by the error message
Stop. ERROR: compilation failed for package ‘mclust’
Stop. ERROR: compilation failed for package ‘quantreg’
You could try to force install them from binary by running: install.packages("mclust", type = "binary") and install.packages("quantreg", type = "binary")

Cannot Install RADammi package

I am trying to install the RADammi package on R 3.6 using "devtools", however I receive this error:
Installing package into ‘C:/Users/taham/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
ERROR: dependencies 'Biostrings', 'IRanges' are not available for package 'RADami'
* removing 'C:/Users/taham/Documents/R/win-library/3.6/RADami'
Error: Failed to install 'unknown package' from URL:
(converted from warning) installation of package > ‘C:/Users/taham/AppData/Local/Temp/RtmpycMnQ2/remotes11246cb38f0/RADami’ had non-zero exit status.
It is an old package that has been removed from CRAN
https://rdrr.io/cran/RADami/
how should I install it?
update:
I finally could manage to install the two dependencies using below command:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Biostrings")
BiocManager::install("IRanges")
I have downloaded the zip archived RADami file and tried to install the package, I receive this fetal error again:
install.packages("C:/Users/taham/Downloads/RADami_1.1-2.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/Users/taham/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
installing source package 'RADami' ...
** package 'RADami' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error: objects 'c.phylo', 'c.multiPhylo' are not exported by 'namespace:ape'
Execution halted
ERROR: lazy loading failed for package 'RADami'
removing 'C:/Users/taham/Documents/R/win-library/3.6/RADami'
Warning in install.packages :
installation of package ‘C:/Users/taham/Downloads/RADami_1.1-2.tar.gz’ had non-> zero exit status
I get the same error when using devtools
It sounds like you need to first install "IRanges" and "Biostrings" from BioConductor:
library(devtools)
install_bioc("IRanges")
install_bioc("Biostrings")
Though these have other dependencies such as "S4Vector" which you may need to install manually also.
Then you should be able to install RADami:
install_url("https://cran.r-project.org/src/contrib/Archive/RADami/RADami_1.0-3.tar.gz")
I also had this issue with installing from the CRAN archive, but was successfully able to install it from the developer's Github. In R:
library(devtools)
install_github("andrew-hipp/RADami")

How to get my installed lib recognized by R

To put it simply, my R could not recognize my "libssl.so.1.0.0" installed.
Wondering any one has any suggestion.
For the details:
I was trying to install a R package "devtools",
but had one issue.
install.packages("devtools")
...
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r/libs/git2r.so':
libssl.so.1.0.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r’
ERROR: dependency ‘openssl’ is not available for package ‘httr’
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/httr’
ERROR: dependencies ‘httr’, ‘git2r’ are not available for package ‘devtools’
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/devtools’
...
it seemed that "libssl.so.1.0.0" is required.
But when I checked which "openssl" I am using:
$ which openssl
~/.anaconda/bin/openssl
$ ldd ~/.anaconda/bin/openssl
linux-vdso.so.1 => (0x00007fffb0de8000)
libssl.so.1.0.0 => /somewhere/Jun/.anaconda/bin/../lib/libssl.so.1.0.0 (0x00002b0618dca000)
libcrypto.so.1.0.0 => /somewhere/Jun/.anaconda/bin/../lib/libcrypto.so.1.0.0 (0x00002b0619041000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003cae000000)
libc.so.6 => /lib64/libc.so.6 (0x0000003cad800000)
/lib64/ld-linux-x86-64.so.2 (0x0000003cad400000)
So it seems to me that "libssl.so.1.0.0" was there, the problem is that R could not find it.
Any suggestion to solve this?
Update:
Another tempt (following 42-'s kind suggestion in the comments)
Adding dependencies=TRUE for "install.packages" command
install.packages("devtools", dependencies=TRUE)
1: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘openssl’ had non-zero exit status
2: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘git2r’ had non-zero exit status
3: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘httr’ had non-zero exit status
4: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘covr’ had non-zero exit status
5: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘gmailr’ had non-zero exit status
6: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘devtools’ had non-zero exit status
7: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘lintr’ had non-zero exit status
tried to install "git2r" first:
install.packages("git2r",dependencies=TRUE)
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘summary’ from package ‘base’ in package ‘git2r’
Creating a generic function for ‘diff’ from package ‘base’ in package ‘git2r’
Creating a generic function for ‘merge’ from package ‘base’ in package ‘git2r’
Creating a generic function for ‘plot’ from package ‘graphics’ in package ‘git2r’
Creating a generic function for ‘head’ from package ‘utils’ in package ‘git2r’
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r/libs/git2r.so':
libssl.so.1.0.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r’
The downloaded source packages are in
‘/tmp/Rtmp55IwjF/downloaded_packages’
Warning message:
In install.packages("git2r", dependencies = TRUE) :
installation of package ‘git2r’ had non-zero exit status

Failing to install R package from archive

I want to install the "fume" package on my Windows machine. I tried this by giving the following command in the console:
install.packages("https://cran.r- project.org/src/contrib/Archive/fume/fume_1.0.tar.gz", repos = NULL, type ="source", INSTALL_opts = c('--no-lock'))
But then I get the following result:
* installing *source* package 'fume' ...
** package 'fume' successfully unpacked and MD5 sums checked
** R
** data
** preparing package for lazy loading
Warning: package 'chron' was built under R version 3.3.1
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
there is no package called 'fume'
Error: loading failed
Execution halted
ERROR: loading failed
* removing '\\COMPANY.local/users$/NAME/R/win-library/3.3/fume'
Warning in install.packages :
running command '"F:/R/R-33~1.0/bin/x64/R" CMD INSTALL --no-lock -l "\\COMPAMY.local\users$\NAME\R\win-library\3.3" "C:/Users/NAME~1.NAME/AppData/Local/Temp/RtmpKY2Wsg/downloaded_packages/fume_1.0.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/NAME~1.NAME/AppData/Local/Temp/RtmpKY2Wsg/downloaded_packages/fume_1.0.tar.gz’ had non-zero exit status
Any ideas on how to install this package correctly?

Resources