R will not install packages - r

RStudio is not letting me install any new packages. As an example, I attempted to install "rio" today and got the following message:
install.packages("rio")
Installing package into ‘C:/Users/kjl5444/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘openxlsx’ is not available
There is a binary version available but the source version is later:
binary source needs_compilation
rio 0.4.0 0.5.5 FALSE
installing the source package ‘rio’
trying URL 'https://cran.rstudio.com/src/contrib/rio_0.5.5.tar.gz'
Content type 'application/x-gzip' length 390824 bytes (381 KB)
downloaded 381 KB
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"C:/Program Files/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\kjl5444\Documents\R\win-library\3.2" C:\Users\kjl5444\AppData\Local\Temp\RtmpaQwlLL/downloaded_packages/rio_0.5.5.tar.gz' had status 1
Warning in install.packages :
installation of package ‘rio’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\kjl5444\AppData\Local\Temp\RtmpaQwlLL\downloaded_packages’
> library(rio)
Error in library(rio) : there is no package called ‘rio’
Any help on deciphering and fixing this error?

While trying to install the rio package in Microsoft windows. I faced an error. In order to resolve that issue, I googled and came to this page.
I know this post is a bit old post but thought to share it for those who face a similar issue in installing this package.
Similar to this post:
Error: "there is no package called ..." and trying to use install.packages to solve it
I could only install rio when I used the command:
install.packages('rio', dependencies = TRUE, repos='http://cran.rstudio.com/')
Perhaps it can help you successfully install the required packages as it ensures that dependencies are also installed along with the required package.

Related

Unable to install XML package to Rstudio

I'm trying to install XML Package to Rstudio Using the ribbon: Tools--> Install Packages --> Packages: to type XML, but the dropdown list opend had only this packages : xml2, XML2R, xml2relational, xmlparsedata, xmlr, xmlrpc2.
Next, I tried:
install.packages("XML")
but received the warning:
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘D:/BCDD/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘XML’ is not available (for R version 3.6.3)
So I followed the link above :https://cran.rstudio.com/bin/windows/Rtools/
and using these questions:
Why can't I install the XML package
Cannot install package XML to R
Then tried
install.packages("XML", repos = "http://www.omegahat.net/R",type="source")
but received the same warning and more:
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘D:/BCDD/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'http://www.omegahat.net/R/src/contrib/XML_3.99-0.tar.gz'
Content type 'application/x-gzip' length 1547930 bytes (1.5 MB)
downloaded 1.5 MB
* installing *source* package 'XML' ...
** using staged installation
Please define LIB_XML (and LIB_ZLIB, LIB_ICONV)
ERROR: configuration failed for package 'XML'
* removing 'D:/BCDD/Documents/R/win-library/3.6/XML'
Warning in install.packages :
installation of package ‘XML’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\BCDD\AppData\Local\Temp\RtmpAhAYpl\downloaded_packages’
Any help to how to install the package XML will be appreciated
You can download the version you want from here: https://cran.rstudio.com//src/contrib/Archive/XML/
According to their GitHub repo, version 3.99-0.3 should work for you, I can't try it out coz I have R4.0 and I can install only the most recent [3.99-0.5].
Alternatively, when you choose the version you want and run on your R console:
devtools::install_version("XML", version = "3.99-0.3") # or the version you want
Have a try. Let me know.
Check this RStudio Support post which covers how to install older versions of packages.
Be sure to install rtools35 from the archive
Going to R 4.0.2 is not a particularly bad idea at this point.

Error in installing *install.packages("tstools")* in language R

I am getting some error while installing package tstools.
Several other packages were installed correctly like(xts, forecast, MAPA, openxslx),
but this one causing trouble.
R version: 3.5.0
RStudio version: 1.1.447
CRAN: Indonesia
OS: windows 10
Here is the error log...
> install.packages("tstools")
Installing package into ‘C:/Users/pc_name/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘data.table’
There is a binary version available but the source version is later:
binary source needs_compilation
tstools 0.3.6 0.3.6.1 FALSE
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘data.table’
These will not be installed
installing the source package ‘tstools’
trying URL 'https://cran.rstudio.com/src/contrib/tstools_0.3.6.1.tar.gz'
Content type 'application/x-gzip' length 960748 bytes (938 KB)
downloaded 938 KB
ERROR: dependency 'data.table' is not available for package 'tstools'
* removing 'C:/Users/pc_name/Documents/R/win-library/3.5/tstools'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘tstools’ had non-zero exit status
The downloaded source packages are in ‘C:\Users\pc_name\AppData\Local\Temp\Rtmp6l4hr7\downloaded_packages’
Have you tried using devtools?
install.packages("devtools")
devtools::install_github("trnnick/TStools")
Sometimes bioconductor also does the trick
source("https://bioconductor.org/biocLite.R")
biocLite("tstools")
Have you tried install.packages("tstools", dependencies = T) ?

Rcpp installation

I just updated R to 3.4.0 and RStudio to 1.0.143, and I reinstalled some packages. Everything was ok except for Rcpp (and packages which require Rccp), I got this :
> install.packages("Rcpp")
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
There is a binary version available but the source version is later:
binary source needs_compilation
Rcpp 0.12.10 0.12.11 TRUE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘Rcpp’
trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_0.12.11.tar.gz'
Content type 'application/x-gzip' length 2485092 bytes (2.4 MB)
downloaded 2.4 MB
'\\CXXXX0001\Users\RXXXXn'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
'\\CXXXX0001\Users\RXXXXn\R\R-3.4.0' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"//CXXXX0001/Users/RXXXn/R/R-3.4.0/bin/x64/R" CMD INSTALL -l "\\CXXXX0001\Users\RXXXXn\R\R-3.4.0\library" C:\Users\RXXX~1\AppData\Local\Temp\RtmpmOL8r0/downloaded_packages/Rcpp_0.12.11.tar.gz' had status 1
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\RXXXXn\AppData\Local\Temp\RtmpmOL8r0\downloaded_packages’
I restarted my R session before doing this, so there should be no conflict of loaded packages.
What can I do ?
EDIT after user3293236 comment
I also have a problem with devtools package...
> install.packages("devtools")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.1.zip'
Content type 'application/zip' length 440923 bytes (430 KB)
downloaded 430 KB
package ‘devtools’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘\\CXXXX0001\Users\RXXXXn\R\R-3.4.0\library\file16401ac3a13\devtools’ to ‘\\CXXXX0001\Users\RXXXXn\R\R-3.4.0\library\devtools’
The downloaded binary packages are in
C:\Users\RXXXXn\AppData\Local\Temp\RtmpmOL8r0\downloaded_packages
> library(devtools)
Error in library(devtools) : aucun package nommé ‘devtools’ n'est trouvé
I encountered the same issue while trying to set up someone else's computer. Brand new R installation (R version 3.4.1) but R was installed in a OneDrive folder. I also thought it was a permissions thing (as #nrussell commented) as the error was the same ... unable to move temporary installation ....
I had no issue installing devtools as normal (or any other packages) and even with Rtools installed Rcpp would not install by install.packages("Rcpp")`. Interestingly,
install.packages("Rcpp", type = 'source')
Did work after some compiling. Strange...
I had similar problem so, I installed a previous Rcpp release and worked.
install_version("Rcpp", version = "1.0.3", repos = "http://cran.us.r-project.org")
What can you do? I would start by reading the error messages.
It clearly showed you that you are offered a different source and binary version. For the former you need tools. That is abundantly documented.
And by tomorrow CRAN will also have a new binary version for you. But with a new release made hours ago, you need to wait a moment. Or make your system capable of installing from source.

Error while installing RSelenium in R

I am getting following error when I try to install the RSelenium package.
install.packages("RSelenium")
Installing package into ‘C:/Users/nshukla/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘binman’ is not available
also installing the dependencies ‘subprocess’, ‘semver’, ‘wdman’
There is a binary version available but the source version is later:
binary source needs_compilation
RSelenium 1.6.2 1.7.1 FALSE
Packages which are only available in source form, and may need compilation of C/C++/Fortran:
‘subprocess’ ‘semver’
These will not be installed
installing the source packages ‘wdman’, ‘RSelenium’
trying URL 'https://cran.rstudio.com/src/contrib/wdman_0.2.2.tar.gz'
Content type 'application/x-gzip' length 26342 bytes (25 KB)
downloaded 25 KB
trying URL 'https://cran.rstudio.com/src/contrib/RSelenium_1.7.1.tar.gz'
Content type 'application/x-gzip' length 4303990 bytes (4.1 MB)
downloaded 4.1 MB
ERROR: dependencies 'binman', 'subprocess', 'semver' are not available
for package 'wdman'
* removing 'C:/Users/nshukla/Documents/R/win-library/3.2/wdman'
Warning in install.packages : running command
'"C:/PROGRA~1/R/R-32~1.3/bin/x64/R" CMD INSTALL -1
"C:\Users\nshukla\Documents\R\win-library\3.2"
C:\Users\nshukla\AppData\Local\Temp\RtmpuAuA2g/downloaded_packages/wdman_0.2.2.tar.gz'
had status 1
Warning in install.packages : installation of package
‘wdman’ had non-zero exit status ERROR: dependencies 'wdman', 'binman'
are not available for package 'RSelenium'
* removing 'C:/Users/nshukla/Documents/R/win-library/3.2/RSelenium'
Warning in install.packages : running command
'"C:/PROGRA~1/R/R-32~1.3/bin/x64/R" CMD INSTALL -l
"C:\Users\nshukla\Documents\R\win-library\3.2"
C:\Users\nshukla\AppData\Local\Temp\RtmpuAuA2g/downloaded_packages/RSelenium_1.7.1.tar.gz'
had status 1
Warning in install.packages : installation of package
‘RSelenium’ had non-zero exit status
The binman package imports semver to parse semantic version strings. This depends on C++11. A version of R >= 3.3.0 is needed to install this. You would need to upgrade your version of R.
This worked for me:
install.packages('RSelenium', type="win.binary")
You could do this:
library(devtools)
install_version("binman", version = "0.1.0", repos = "https://cran.uni-muenster.de/")
install_version("wdman", version = "0.2.2", repos = "https://cran.uni-muenster.de/")
install_version("RSelenium", version = "1.7.1", repos = "https://cran.uni-muenster.de/")
This is the answer of FabianFox on the github page: https://github.com/ropensci/RSelenium/issues/172

install package on rstudio server ubuntu 12.04.1

I followed the instructions on randyzwitch's blog (http://randyzwitch.com/r-amazon-ec2/) to install r-studio server on ec2 instance running ubuntu 12.04.
When I start r-studio server and try to install packages, this is what was happening:
> install.packages("dplyr")
Warning in install.packages :
package ‘dplyr’ is not available (for R version 2.14.1)
Installing package(s) into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to create a personal library
~/R/x86_64-pc-linux-gnu-library/2.14
to install packages into? (y/n) y
Warning in install.packages :
package ‘dplyr’ is not available (for R version 2.14.1)
I realized I need to update R so I checked out this post and updated it: https://askubuntu.com/questions/218708/installing-latest-version-of-r-base/436491#436491
I am logged in as sudo user. When I try to install package now, i get this:
> install.packages("plyr")
Installing package into ‘/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘Rcpp’
trying URL 'http://cran.rstudio.com/src/contrib/Rcpp_0.11.5.tar.gz'
Content type 'application/x-gzip' length 2353791 bytes (2.2 MB)
==================================================
downloaded 2.2 MB
trying URL 'http://cran.rstudio.com/src/contrib/plyr_1.8.2.tar.gz'
Content type 'application/x-gzip' length 392136 bytes (382 KB)
==================================================
downloaded 382 KB
Warning in install.packages :
system call failed: Cannot allocate memory
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
Warning in install.packages :
system call failed: Cannot allocate memory
Warning in install.packages :
installation of package ‘plyr’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp6Kgx5d/downloaded_packages’
I saw this post : lme4 package install failing on Ubuntu 12.04 and followed all instructions but it didn't solve the problem. Still same result. Thoroughly frustrated with trying to run rstudio server on aws. Someone please help!
Are you using the instance type t2.micro? Try using a more powerful instance with more RAM, that worked for me.
Please make sure you are root user when installing packages:
sudo su command will take you to root user. Then run your install package code.
or use sudo before run you script: sudo Rscript 1.R

Resources