Unable to download packages: non-zero exit status

Error Information: Hi! I'm relatively new to R, so I might be missing something super obvious here. But since updating RStudio, packages I used to have have disappeared and I'm unable to reinstall them. Here is what happens when I try:

> install.packages("BiodiversityR")
also installing the dependency ‘Rcmdr’


  There are binary versions available but the source versions are later:
              binary source needs_compilation
Rcmdr          2.6-2  2.7-1             FALSE
BiodiversityR 2.11-3 2.13-1             FALSE

installing the source packages ‘Rcmdr’, ‘BiodiversityR’

trying URL 'https://cran.rstudio.com/src/contrib/Rcmdr_2.7-1.tar.gz'
Content type 'application/x-gzip' length 4817926 bytes (4.6 MB)
==================================================
downloaded 4.6 MB

trying URL 'https://cran.rstudio.com/src/contrib/BiodiversityR_2.13-1.tar.gz'
Content type 'application/x-gzip' length 689008 bytes (672 KB)
==================================================
downloaded 672 KB

* installing *source* package ‘Rcmdr’ ...
** package ‘Rcmdr’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: X11 library is missing: install XQuartz from xquartz.macosforge.org
ERROR: lazy loading failed for package ‘Rcmdr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcmdr’
Warning in install.packages :
  installation of package ‘Rcmdr’ had non-zero exit status
ERROR: dependency ‘Rcmdr’ is not available for package ‘BiodiversityR’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BiodiversityR’
Warning in install.packages :
  installation of package ‘BiodiversityR’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/n1/p8rtxp4d1lvb0wgmbv2t63740000gn/T/Rtmp3azpQY/downloaded_packages’

The output of running sessionInfo() is as follows:

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] readxl_1.3.1      ggsci_2.9         viridis_0.5.1     viridisLite_0.3.0 ggordiplots_0.4.0 glue_1.4.2       
 [7] factoextra_1.0.7  forcats_0.5.1     stringr_1.3.1     dplyr_1.0.7       purrr_0.3.4       readr_1.3.1      
[13] tidyr_1.0.0       tibble_3.1.2      tidyverse_1.2.1   ggplot2_3.3.3     vegan_2.5-2       lattice_0.20-35  
[19] permute_0.9-4    

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1 haven_2.1.0      colorspace_1.3-2 vctrs_0.3.8      generics_0.0.2   yaml_2.2.0       mgcv_1.8-24     
 [8] utf8_1.1.4       rlang_0.4.11     pillar_1.6.1     withr_2.1.2      DBI_1.0.0        modelr_0.1.4     lifecycle_1.0.0 
[15] munsell_0.5.0    gtable_0.2.0     cellranger_1.1.0 rvest_0.3.4      labeling_0.3     parallel_3.5.1   fansi_0.4.0     
[22] broom_0.7.8      Rcpp_1.0.7       scales_1.0.0     backports_1.1.4  jsonlite_1.5     gridExtra_2.3    hms_0.4.2       
[29] digest_0.6.15    stringi_1.2.4    ggrepel_0.8.2    grid_3.5.1       cli_1.0.0        tools_3.5.1      magrittr_1.5    
[36] cluster_2.0.7-1  crayon_1.3.4     pkgconfig_2.0.2  MASS_7.3-50      ellipsis_0.3.2   Matrix_1.2-14    xml2_1.2.0      
[43] lubridate_1.7.4  assertthat_0.2.1 httr_1.4.0       rstudioapi_0.10  R6_2.4.0         nlme_3.1-137     compiler_3.5.1  

Can anyone help?

This line is the most important one from the output:

  error: X11 library is missing: install XQuartz from xquartz.macosforge.org

You can install XQuartz, or (probably easier), install the slightly older binary version of Rcmdr. To do the latter, when it says "There are binary versions available but the source versions are later. Do you want to install from sources the package which needs compilation?" choose no.

Eventually the binary version on CRAN will catch up to the source version (when there's an update to a package, it takes some time to build the binaries).

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.