For my bachelor thesis I need to work with "car" and "mlogit" and need to install these packages in RStudio. For whatever reason installing them does not work.
For install.packages("car")
or any other package, I get error messages saying, that installation of package xyz "had non-zero exit status".
I tried reinstalling R and RStudio, made sure it's the latest version and checked for compatibility (I'm using Ubuntu 20.04 LTS) but I just can't get it to work. Other posts here and elsewhere could not help me resolve the issue. I'm connected to the internet, and deactivated "use secure download method for http" in global options. Also trying to install via R and not RStudio did not work.
I'm sorry if this post is not formatted properly, I've only used R on very basic levels before and am a little overwhelmed with the amount of information and possibilities. Help would be very much appreciated!
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether the C++ compiler works... no
configure: error: in `/tmp/Rtmp1UE3Tm/R.INSTALL28df5f0245e9/nloptr':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘nloptr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
* installing *source* package ‘statmod’ ...
** Paket ‘statmod’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
sh: 1: make: not found
Warnung in system(cmd) Fehler bei der Ausführung des Befehls
ERROR: compilation failed for package ‘statmod’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/statmod’
Warning in install.packages :
installation of package ‘statmod’ had non-zero exit status
* installing *source* package ‘RcppEigen’ ...
** Paket ‘RcppEigen’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
sh: 1: make: not found
Warnung in system(cmd) Fehler bei der Ausführung des Befehls
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/RcppEigen’
Warning in install.packages :
installation of package ‘RcppEigen’ had non-zero exit status
* installing *source* package ‘purrr’ ...
** Paket ‘purrr’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
sh: 1: make: not found
Warnung in system(cmd) Fehler bei der Ausführung des Befehls
ERROR: compilation failed for package ‘purrr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/purrr’
Warning in install.packages :
installation of package ‘purrr’ had non-zero exit status
ERROR: dependency ‘stringi’ is not available for package ‘stringr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/stringr’
Warning in install.packages :
installation of package ‘stringr’ had non-zero exit status
* installing *source* package ‘lifecycle’ ...
** Paket ‘lifecycle’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Fehler in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.6 is being loaded, but >= 0.4.10 is required
Ruft auf: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Ausführung angehalten
ERROR: lazy loading failed for package ‘lifecycle’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/lifecycle’
* restoring previous ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/lifecycle’
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status
* installing *source* package ‘vctrs’ ...
** Paket ‘vctrs’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
sh: 1: make: not found
Warnung in system(cmd) Fehler bei der Ausführung des Befehls
ERROR: compilation failed for package ‘vctrs’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/vctrs’
* restoring previous ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/vctrs’
Warning in install.packages :
installation of package ‘vctrs’ had non-zero exit status
ERROR: dependency ‘xfun’ is not available for package ‘highr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/highr’
Warning in install.packages :
installation of package ‘highr’ had non-zero exit status
ERROR: dependencies ‘xfun’, ‘mime’ are not available for package ‘markdown’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/markdown’
Warning in install.packages :
installation of package ‘markdown’ had non-zero exit status
ERROR: dependencies ‘matrixStats’, ‘RcppArmadillo’ are not available for package ‘conquer’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/conquer’
Warning in install.packages :
installation of package ‘conquer’ had non-zero exit status
ERROR: dependencies ‘zip’, ‘stringi’ are not available for package ‘openxlsx’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/openxlsx’
Warning in install.packages :
installation of package ‘openxlsx’ had non-zero exit status
ERROR: dependency ‘sp’ is not available for package ‘maptools’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/maptools’
Warning in install.packages :
installation of package ‘maptools’ had non-zero exit status
ERROR: dependencies ‘minqa’, ‘nloptr’, ‘statmod’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/lme4’
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
ERROR: dependency ‘purrr’ is not available for package ‘tidyselect’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/tidyselect’
Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
* installing *source* package ‘readr’ ...
** Paket ‘readr’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
sh: 1: make: not found
Warnung in system(cmd) Fehler bei der Ausführung des Befehls
ERROR: compilation failed for package ‘readr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/readr’
Warning in install.packages :
installation of package ‘readr’ had non-zero exit status
ERROR: dependencies ‘highr’, ‘markdown’, ‘stringr’, ‘yaml’, ‘xfun’ are not available for package ‘knitr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/knitr’
Warning in install.packages :
installation of package ‘knitr’ had non-zero exit status
ERROR: dependencies ‘SparseM’, ‘conquer’ are not available for package ‘quantreg’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/quantreg’
Warning in install.packages :
installation of package ‘quantreg’ had non-zero exit status
ERROR: dependency ‘tidyselect’ is not available for package ‘dplyr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/dplyr’
Warning in install.packages :
installation of package ‘dplyr’ had non-zero exit status
ERROR: dependencies ‘readr’, ‘tidyselect’ are not available for package ‘haven’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/haven’
Warning in install.packages :
installation of package ‘haven’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘purrr’, ‘tidyselect’ are not available for package ‘tidyr’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/tidyr’
Warning in install.packages :
installation of package ‘tidyr’ had non-zero exit status
ERROR: dependencies ‘haven’, ‘curl’, ‘data.table’, ‘readxl’, ‘openxlsx’ are not available for package ‘rio’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/rio’
Warning in install.packages :
installation of package ‘rio’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘purrr’, ‘stringr’, ‘tidyr’ are not available for package ‘broom’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/broom’
Warning in install.packages :
installation of package ‘broom’ had non-zero exit status
ERROR: dependencies ‘lme4’, ‘broom’, ‘dplyr’, ‘knitr’ are not available for package ‘pbkrtest’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/pbkrtest’
Warning in install.packages :
installation of package ‘pbkrtest’ had non-zero exit status
ERROR: dependencies ‘pbkrtest’, ‘quantreg’, ‘maptools’, ‘rio’, ‘lme4’ are not available for package ‘car’
* removing ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6/car’
Warning in install.packages :
installation of package ‘car’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp1ckunQ/downloaded_packages’
Since you are on a Linux OS and you are using a regular CRAN mirror you are forced to compile packages from source but to be able to do that, you need to have the proper tools installed in your system, I don't have a list of every possible system dependency but these are some common ones you might try:
I will try this, thanks. How do I install dependencies?
I tried via install.packages() and RStudio told me:
> install.packages("cmake")
Installing package into ‘/home/clara/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘cmake’ is not available (for R version 3.6.3)
Those are system dependencies, not R packages, you have to install them from a system terminal not from the R console, I don't know what Linux distribution you are using but for example on Debian based systems the command would be
sudo apt install cmake
EDIT: I just realized you said you are using Ubuntu (which is a Debian-based Linux distribution) so using sudo apt insall should work just fine.