install package on rstudio server ubuntu 12.04.1 - r

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

Related

Having problems installing.packag("BatchGetSymbols")

I can't install.package("BatchGetSymbols") for some reason.
I am just doing this:
install.packages('BatchGetSymbols')
library(BatchGetSymbols)
and i am getting this:
> install.packages('BatchGetSymbols')
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘XML’ is not available
trying URL 'https://cran.rstudio.com/src/contrib/BatchGetSymbols_2.5.7.tar.gz'
Content type 'application/x-gzip' length 181321 bytes (177 KB)
==================================================
downloaded 177 KB
ERROR: dependency ‘XML’ is not available for package ‘BatchGetSymbols’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.6/BatchGetSymbols’
Warning in install.packages :
installation of package ‘BatchGetSymbols’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpAhaAos/downloaded_packages’
> library(BatchGetSymbols)
Error in library(BatchGetSymbols) :
there is no package called ‘BatchGetSymbols’
Does anyone understand why there is a problem??
Install the latest version of R before
Commands to install: https://cloud.r-project.org/bin/linux/
Choose the version of your system and run the commands
After that try to install the library.

R will not install packages

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.

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

ggplot2 fails to install on R 3.0.2

I am unable to install ggplot2 in R 3.0.2 on Ubuntu.
When I run
install.packages('ggplot2',dependencies = TRUE)
I get the following error.
> install.packages('ggplot2',dependencies = TRUE)
Installing package into ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependencies ‘plyr’, ‘testthat’ are not available
also installing the dependencies ‘reshape2’, ‘scales’, ‘Hmisc’
trying URL 'http://cran.rstudio.com/src/contrib/reshape2_1.4.1.tar.gz'
Content type 'application/x-gzip' length 34693 bytes (33 Kb)
opened URL
==================================================
downloaded 33 Kb
trying URL 'http://cran.rstudio.com/src/contrib/scales_0.2.4.tar.gz'
Content type 'application/x-gzip' length 40093 bytes (39 Kb)
opened URL
==================================================
downloaded 39 Kb
trying URL 'http://cran.rstudio.com/src/contrib/Hmisc_3.16-0.tar.gz'
Content type 'application/x-gzip' length 629536 bytes (614 Kb)
opened URL
==================================================
downloaded 614 Kb
trying URL 'http://cran.rstudio.com/src/contrib/ggplot2_1.0.1.tar.gz'
Content type 'application/x-gzip' length 2351203 bytes (2.2 Mb)
opened URL
==================================================
downloaded 2.2 Mb
ERROR: dependency ‘plyr’ is not available for package ‘reshape2’
* removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/reshape2’
Warning in install.packages :
installation of package ‘reshape2’ had non-zero exit status
ERROR: dependency ‘plyr’ is not available for package ‘scales’
* removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/scales’
Warning in install.packages :
installation of package ‘scales’ had non-zero exit status
ERROR: dependencies ‘plyr’, ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
* removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
ERROR: dependencies ‘ggplot2’, ‘scales’ are not available for package ‘Hmisc’
* removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/Hmisc’
Warning in install.packages :
installation of package ‘Hmisc’ had non-zero exit status
I also tried
install.packages(c('reshape2','scales'))
Get the error that plyr is not available.
I also upgraded Ubuntu and also reinstalled latest version of R and updated the packages using update.packages(checkBuilt=TRUE).
But, nothing worked. What can I do?
If you do not need the latest version, you can install the packaged version distributed by Ubuntu by using:
sudo apt-get install r-cran-ggplot2
I fixed this problem by typing these command:
$ sudo apt-get install r-cran-plyr
$ sudo apt-get install r-cran-reshape2
You should update your R version (r-base) to the latest.
Command line like:
$ sudo apt-get update
$ sudo apt-get install r-base
updated didn't work for me.
First uninstall R.
Then download 3.2.1 deb file from the link:
http://cran.es.r-project.org/bin/linux/ubuntu/trusty/
Install it by Ubuntu software center.
Run install.packages as regular.
apt-get tracks what repos to look for packages in /etc/apt/sources.list. The default set defined in most people's sources.list does not include CRAN mirrors. For Ubuntu users, you can add the following line to /etc/apt/sources.list:
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <linux ver>/
I use 'trusty' Ubuntu version and prefer the berkley cran mirror, so my line looks like:
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu trusty/
If you need to find out your Ubuntu version, try running:
lsb_release -a
Now apt-get can interact with a CRAN mirror for you. Enjoy!
Download the newest version of r-base (3.2.2) from [http://cran.es.r-project.org/bin/linux/ubuntu/trusty/]
use Ubuntu software Centre to open it and install.
This would update your already installed version to the latest. Then try installing the ggplot2 packgage again. It worked for me like magic.
Good luck with it!!

Resources