Error in installing 'dplyr' package - has non-zero exit status - r

When I invoke
install.packages("dplyr")
this is what shows up:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://mran.microsoft.com/snapshot/2019-07-05/src/contrib/dplyr_0.8.3.tar.gz'
Content type 'application/octet-stream' length 1173098 bytes (1.1 MB)
==================================================
downloaded 1.1 MB
ERROR: failed to lock directory ‘/usr/local/lib/R/site-library’ for modifying
Try removing ‘/usr/local/lib/R/site-library/00LOCK-dplyr’
Warning in install.packages :
installation of package ‘dplyr’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpDn3GWa/downloaded_packages’
It also looks like this dplyr package is no longer in my User Library.
Please help! Other installation of packages seem to be working fine. I have no idea what's going on because I have always had no issues with this package until today and I desperately need this for my final next week.
Thanks!

All of what i'm posting here is provinient on the link, post here for resume:
install.packages("Rcpp", dependencies = TRUE, INSTALL_opts = '--no-lock')
Why this happens ?
This happens when your last package installation has interrupted abnormally. to fix this you should remove the locked file. For example Execute this command in R console:
unlink("/home/me/src/Rlibs/00LOCK-Rcpp", recursive = TRUE)
R install.packages returns "failed to create lock directory"

Related

Trouble installing glmmTMB

I was using glmmTMB on a cluster. It was working for several weeks. I logged on today and it says I need to install glmmTMB. So, I tried that, but R is giving me the error below.
The main part says: failed to lock directory.
Thanks for any advice.
Installing package into ‘/home/xxxxxx/R/x86_64-redhat-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/glmmTMB_1.1.2.3.tar.gz'
Content type 'application/x-gzip' length 3910643 bytes (3.7 MB)
==================================================
downloaded 3.7 MB
ERROR: failed to lock directory ‘/home/xxxxxx/R/x86_64-redhat-linux-gnu-library/4.0’ for modifying
Try removing ‘/home/xxxxxx/R/x86_64-redhat-linux-gnu-library/4.0/00LOCK-glmmTMB’
Warning in install.packages :
installation of package ‘glmmTMB’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpYJgfa7/downloaded_packages’

"Powder" from Github not installing (RStudio)

I'm trying to run this piece of code from a Github read.me file
## Install
```{r,eval=FALSE}
#install.packages('devtools')
devtools::install_github('jeff324/powder',build_vignettes = TRUE)
```
However. I keep getting this error message back in the console:
Downloading GitHub repo jeff324/powder#HEAD
Installing 1 packages: tibble
Installing package into ‘C:/Users/tessc/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tibble_3.0.6.zip'
Content type 'application/zip' length 836388 bytes (816 KB)
downloaded 816 KB
package ‘tibble’ successfully unpacked and MD5 sums checked
Error: Failed to install 'powder' from GitHub:
(converted from warning) cannot remove prior installation of package ‘tibble’
>
Does anyone know what might be happening?
First thing I do when I get these types of errors is to Restart R. Go to Session -> Restart R. If that doesn't work, try opening a brand new session in R Studio. I was just able to install this package. So fundamentally, it is working.

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.

Error in library(ggplot2) : There is no package called 'ggplot2'

I'm new to R and I'm just trying to get through some tutorials.
When I try installing ggplot2, I get this error.
Error in library(ggplot2) : There is no package called 'ggplot2'
I tried these in R and RStudio.
install.packages("ggplot2", dep=T)
install.packages('ggplot2', repos='http://cran.us.r-project.org')
remove.packages("ggplot2")
but I get the error
(Error in remove.packages : there is no package called 'ggplot2')
This is what I get from install.packages("ggplot2")
> install.packages("ggplot2")
Installing package into ‘.../R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = ".../R/win-library/3.4"' is not writable
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/ggplot2_2.2.1.zip'
Content type 'application/zip' length 2784566 bytes (2.7 MB)
downloaded 2.7 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘ggplot2’
The downloaded binary packages are in
C:...\AppData\Local\temp\RtmpqaGNpr\downloaded_packages
I removed all ggplot2 files manually then tried to install again. Here's my result.
> install.packages("ggplot2")
Installing package into ‘.../R/win-library/3.4’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://ftp.osuosl.org/pub/cran/bin/windows/contrib/3.4/ggplot2_2.2.1.zip'
Content type 'application/zip' length 2784566 bytes (2.7 MB)
downloaded 2.7 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
Warning: unable to move temporary installation ‘...\R\win-library\3.4\file26b43a54980\ggplot2’ to ‘...\R\win-library\3.4\ggplot2’
The downloaded binary packages are in
C:...\AppData\Local\temp\Rtmpq0T9a6\downloaded_packages
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
> library("ggplot2")
Error in library("ggplot2") : there is no package called ‘ggplot2’
These code was run using R 3.4.2
Steps
Go To Tools
Install Packages
In Packages Text Box Type ggplot2
Check the checkbox install dependencies
When having this issue I would suggest :
try turning it off and on again
update R to last version if possible
remove manually all the folders related to the relevant package and retry the installation
change your default library location : How do you change library location in R?
Try launching R client directly from command prompt, then issue the instruction:
install.packages("ggplot2", lib="C:/Users/YourUser/Documents/R/win-library/3.3")
You need to update your R version and do this but you'll need install all packages again:
Tool > Global Options > R version (CHANGE) > Select "Use your machine's default version of R..."

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