Unable to install olsrr in RStudio but I can install it in R

package-installation

#1

I have no problem installing and using this package in R, but I get many error messages when I try to install it in RStudio. Here is what I get after several lines of downloads completed. There are many messages that talk about 'non zero exit status.' Any help in layman's terms would be greatly appreciated.

* installing *source* package ‘zip’ ...
** package ‘zip’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/Nicolas/anaconda3/include  -c init.c -o init.o
make: x86_64-apple-darwin13.4.0-clang: No such file or directory
make: *** [init.o] Error 1
ERROR: compilation failed for package ‘zip’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/zip’
Warning in install.packages :
  installation of package ‘zip’ had non-zero exit status
* installing *source* package ‘SparseM’ ...
** package ‘SparseM’ successfully unpacked and MD5 sums checked
** libs
/Users/Nicolas/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran   -fPIC  -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -I/Users/Nicolas/anaconda3/include -L/Users/Nicolas/anaconda3/lib  -c bckslv.f -o bckslv.o
make: /Users/Nicolas/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran: No such file or directory
make: *** [bckslv.o] Error 1
ERROR: compilation failed for package ‘SparseM’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/SparseM’
Warning in install.packages :
  installation of package ‘SparseM’ had non-zero exit status
* installing *source* package ‘sp’ ...
** package ‘sp’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/Nicolas/anaconda3/include  -c Rcentroid.c -o Rcentroid.o
make: x86_64-apple-darwin13.4.0-clang: No such file or directory
make: *** [Rcentroid.o] Error 1
ERROR: compilation failed for package ‘sp’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/sp’
Warning in install.packages :
  installation of package ‘sp’ had non-zero exit status
* installing *source* package ‘haven’ ...
** package ‘haven’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG  -I"/Users/Nicolas/anaconda3/lib/R/library/Rcpp/include" -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include  -Ireadstat -DHAVE_ZLIB -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/Nicolas/anaconda3/include  -c tagged_na.c -o tagged_na.o
/bin/sh: x86_64-apple-darwin13.4.0-clang: command not found
make: *** [tagged_na.o] Error 127
ERROR: compilation failed for package ‘haven’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/haven’
Warning in install.packages :
  installation of package ‘haven’ had non-zero exit status
* installing *source* package ‘minqa’ ...
** package ‘minqa’ successfully unpacked and MD5 sums checked
** libs
/Users/Nicolas/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran   -fPIC  -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -I/Users/Nicolas/anaconda3/include -L/Users/Nicolas/anaconda3/lib  -c altmov.f -o altmov.o
make: /Users/Nicolas/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran: No such file or directory
make: *** [altmov.o] Error 1
ERROR: compilation failed for package ‘minqa’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/minqa’
Warning in install.packages :
  installation of package ‘minqa’ had non-zero exit status
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking whether the C++ compiler works... no
configure: error: in `/private/var/folders/h2/q6lytrd93qv1qpygp_sbzynr0000gn/T/RtmpBF9sjt/R.INSTALL7d133267d3a2/nloptr':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘nloptr’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/nloptr’
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang++  -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG  -I"/Users/Nicolas/anaconda3/lib/R/library/Rcpp/include" -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include  -I../inst/include -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden  -fmessage-length=0 -I/Users/Nicolas/anaconda3/include  -c RcppEigen.cpp -o RcppEigen.o
/bin/sh: x86_64-apple-darwin13.4.0-clang++: command not found
make: *** [RcppEigen.o] Error 127
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/RcppEigen’
Warning in install.packages :
  installation of package ‘RcppEigen’ had non-zero exit status
* installing *source* package ‘geometry’ ...
** package ‘geometry’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG -include Rgeometry.h  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/Nicolas/anaconda3/include  -c Rconvhulln.c -o Rconvhulln.o
make: x86_64-apple-darwin13.4.0-clang: No such file or directory
make: *** [Rconvhulln.o] Error 1
ERROR: compilation failed for package ‘geometry’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/geometry’
Warning in install.packages :
  installation of package ‘geometry’ had non-zero exit status
* installing *source* package ‘broom’ ...
** package ‘broom’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace ‘rlang’ 0.1.2 is already loaded, but >= 0.2.0 is required
ERROR: lazy loading failed for package ‘broom’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/broom’
Warning in install.packages :
  installation of package ‘broom’ had non-zero exit status
* installing *source* package ‘checkmate’ ...
** package ‘checkmate’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/Nicolas/anaconda3/include  -c all_missing.c -o all_missing.o
make: x86_64-apple-darwin13.4.0-clang: No such file or directory
make: *** [all_missing.o] Error 1
ERROR: compilation failed for package ‘checkmate’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/checkmate’
Warning in install.packages :
  installation of package ‘checkmate’ had non-zero exit status
* installing *source* package ‘goftest’ ...
** package ‘goftest’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I/Users/Nicolas/anaconda3/lib/R/include -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/Nicolas/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/Nicolas/anaconda3/include  -c ADinf.c -o ADinf.o
make: x86_64-apple-darwin13.4.0-clang: No such file or directory
make: *** [ADinf.o] Error 1
ERROR: compilation failed for package ‘goftest’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/goftest’
Warning in install.packages :
  installation of package ‘goftest’ had non-zero exit status
ERROR: dependency ‘zip’ is not available for package ‘openxlsx’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/openxlsx’
Warning in install.packages :
  installation of package ‘openxlsx’ had non-zero exit status
ERROR: dependency ‘SparseM’ is not available for package ‘quantreg’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/quantreg’
Warning in install.packages :
  installation of package ‘quantreg’ had non-zero exit status
ERROR: dependency ‘sp’ is not available for package ‘maptools’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/maptools’
Warning in install.packages :
  installation of package ‘maptools’ had non-zero exit status
ERROR: dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/lme4’
Warning in install.packages :
  installation of package ‘lme4’ had non-zero exit status
ERROR: dependency ‘geometry’ is not available for package ‘ddalpha’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/ddalpha’
Warning in install.packages :
  installation of package ‘ddalpha’ had non-zero exit status
ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/pbkrtest’
Warning in install.packages :
  installation of package ‘pbkrtest’ had non-zero exit status
ERROR: dependencies ‘haven’, ‘openxlsx’ are not available for package ‘rio’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/rio’
Warning in install.packages :
  installation of package ‘rio’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘ddalpha’ are not available for package ‘recipes’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/recipes’
Warning in install.packages :
  installation of package ‘recipes’ had non-zero exit status
ERROR: dependencies ‘pbkrtest’, ‘quantreg’, ‘maptools’, ‘rio’, ‘lme4’ are not available for package ‘car’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/car’
Warning in install.packages :
  installation of package ‘car’ had non-zero exit status
ERROR: dependencies ‘car’, ‘checkmate’, ‘goftest’, ‘recipes’ are not available for package ‘olsrr’
* removing ‘/Users/Nicolas/anaconda3/lib/R/library/olsrr’
Warning in install.packages :
  installation of package ‘olsrr’ had non-zero exit status

#2

There is a lot going on here - can you clarify a couple of things for us:

  1. What version of R do you have installed?
  2. What version of RStudio do you have installed?
  3. Is your R version also using the Anaconda library like your RStudio version is?
  4. Are you trying to install olsrr via install.packages() or some other way?

If you are interested in using R via Anaconda, check out this thread - specifically @jcblum's caveats about using conda for R.

If you are able to install olsrr through R, the package should already be available to RStudio. If not, I suspect you have multiple libraries of R packages on your computer that are not shared between R and RStudio. I would be interested in seeing what the output of the .libPaths() function is for both R and RStudio.

I did just check on my computer and olsrr does indeed install correctly - I'm on the latest version of R and the preview version of RStudio v1.2 on macOS 10.13.6.


#3

To translate the errors a bit...

Most of these errors are originating when R is trying to install packages from source which need to be compiled (they don’t contain exclusively R code, but also have code in other languages like C/C++ and Fortran). The R installation that RStudio is using is looking for the compilers it needs within your anaconda installation, but it’s not finding them there (or what it finds isn’t quite what it needs).

The errors at the end are happening as a result of the earlier errors — packages are failing to load because other packages they depend on failed to install.

“Non-zero exit status” just means “something went wrong” (this is a longstanding UNIX convention).

In general with R installation messages, the last couple lines of the output are often pretty generic (and therefore uninformative). Further up, R is narrating its progress as it tries to install, and that’s where you’ll find the clues to what went wrong.

Beyond that, your best bet is to follow @chris.prener’s excellent advice for what additional info you’ll need to gather to try to sort this out!


#4

Thank you Chris and jcblum for getting to this question so quickly. It is much appreciated.

  1. The version of R I have is: R version 3.5.1 (2018-07-02) -- "Feather Spray"
  2. The version of RStudio I have is: Version 1.1.383
  3. I am quite sure I have two different libraries for R and RStudio. That was actually wondering if I could direct RStudio to use my R library. I also tried just moving the olsrr folder from my R library to my RStudio library. RStudio doesnt like that.
  4. I am trying to install olsrr via install.packages.

Here is the output for .libPaths():
R:

.libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.5/Resources/library"

RStudio:

.libPaths()
[1] "/Users/Nicolas/anaconda3/lib/R/library"

Thank you again for all your help!


#5

There are some discussions on stack about how you could potentially modify your .Rprofile to get this to work properly. I’ve never had to do this before, but my sense is that it would be better to address the root problem - you have two competing installations of R on your computer. Do you need both? If not, uninstall one (the Conda installation seems to be the candidate for this based on your past answers).


#6

This more recent post from this evening might provide a different route, @nlhennings - Package list error in Rstudio.


#7

I updated RStudio, and now everything works perfectly. I can install packages again with no errors!