Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access User Library in R - "Non-Zero Exit Status" warning

When I tried to install packages on my work laptop, I got an error. I've been told that I have full privileges with the laptop, so there should be no blocks.

I think it might be something to do with the file path to the library where installed packages go? I'm using both the latest version of R and R Studio, 64-bit, and using Canada's U of T CRAN mirror site.

Here is what comes up when I try to install plyr with

install.packages("plyr")

also installing the dependency ‘Rcpp’ Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘Rcpp’ ‘plyr’

And when I try to install ggplot2, here is the long error message:

ERROR: dependency 'stringi' is not available for package 'stringr' * removing 'C:/RPackages/R-3.2.3/library/stringr' Warning in install.packages : running command '"C:/RPACKA~1/R-32~1.3/bin/x64/R" CMD INSTALL -l "C:\RPackages\R-3.2.3\library" C:\Users\MICHAE~1.COL\AppData\Local\Temp\RtmpGs24zA/downloaded_packages/stringr_1.0.0.tar.gz' had status 1 Warning in install.packages : installation of package ‘stringr’ had non-zero exit status ERROR: dependency 'colorspace' is not available for package 'munsell' * removing 'C:/RPackages/R-3.2.3/library/munsell' Warning in install.packages : running command '"C:/RPACKA~1/R-32~1.3/bin/x64/R" CMD INSTALL -l "C:\RPackages\R-3.2.3\library" C:\Users\MICHAE~1.COL\AppData\Local\Temp\RtmpGs24zA/downloaded_packages/munsell_0.4.3.tar.gz' had status 1 Warning in install.packages : installation of package ‘munsell’ had non-zero exit status ERROR: dependencies 'digest', 'plyr', 'reshape2', 'scales' are not available for package 'ggplot2' * removing 'C:/RPackages/R-3.2.3/library/ggplot2' Warning in install.packages : running command '"C:/RPACKA~1/R-32~1.3/bin/x64/R" CMD INSTALL -l "C:\RPackages\R-3.2.3\library" C:\Users\MICHAE~1.COL\AppData\Local\Temp\RtmpGs24zA/downloaded_packages/ggplot2_2.0.0.tar.gz' had status 1 Warning in install.packages : installation of package ‘ggplot2’ had non-zero exit status The downloaded source packages are in ‘C:\Users\michael.colangelo\AppData\Local\Temp\RtmpGs24zA\downloaded_packages’

What does "non-zero exit status" mean? Is it trying to find a library for the installation?> The appData file mentioned in the code doesn't seem to exist or I cannot access it. How do I change it to another local folder?

like image 862
Mike Avatar asked Feb 27 '16 06:02

Mike


People also ask

What does non-zero exit status mean in R?

3.7. 5 Exit Status Under certain circumstances, the shell will use special values to indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit status has succeeded. A non-zero exit status indicates failure.

Had non-zero exit status rstudio?

"non-zero exit status" simply means that the package has not been installed, it tells us nothing about the cause, we need to see a complete output message to see what is going on.

What is a non-zero exit code?

Any non-zero exit code (commonly 1 or -1) conventionally means that there was some sort of error during the pro- gram's executing that prevented the program from com- pleting successfully.


2 Answers

A non-zero exit status means in this case that the system failed to install the package. There seem to be a number of unresolved dependencies in the installation process. You could try to resolve this by attempting to install the package using the option dependencies=TRUE; like this:

install.packages("ggplot2", dependencies=TRUE)
like image 62
RHertel Avatar answered Oct 28 '22 01:10

RHertel


i was struggling with the same problem, for a long time and mikes solution didnt help me either. I tried everything upto reinstalling R. Still didnt work. However the solution is quite simple in my case. In the Terminal dont run R as R but use:

sudo -i R

or change ownership of the r package folders, becaues if its owned by root you are not allowed to read or write in it.

like image 27
Joyvalley Avatar answered Oct 28 '22 02:10

Joyvalley