R not downloading new packages

I'm not entirely new to R, but I am also not well-versed in resolving back-end issues.
I have R Version 2023.03.2+454 (2023.03.2+454). I updated it about a month ago and the issues began.
I'm using a MacOS Sonoma 14.0 system.
I'm trying
install.packages(gtsummary)

This is an end snipped of the error code it gives me:

Warning in install.packages :
  installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘xfun’ ...
** package ‘xfun’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘xfun’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/xfun’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/xfun’
Warning in install.packages :
  installation of package ‘xfun’ had non-zero exit status
* installing *source* package ‘vctrs’ ...
** package ‘vctrs’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘vctrs’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/vctrs’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/vctrs’
Warning in install.packages :
  installation of package ‘vctrs’ had non-zero exit status
ERROR: dependency ‘V8’ is not available for package ‘juicyjuice’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/juicyjuice’
Warning in install.packages :
  installation of package ‘juicyjuice’ had non-zero exit status
* installing *source* package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace ‘xfun’ 0.37 is being loaded, but >= 0.39 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘knitr’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/knitr’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/knitr’
Warning in install.packages :
  installation of package ‘knitr’ had non-zero exit status
* installing *source* package ‘tibble’ ...
** package ‘tibble’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘tibble’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tibble’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tibble’
Warning in install.packages :
  installation of package ‘tibble’ had non-zero exit status
* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘dplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/dplyr’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/dplyr’
Warning in install.packages :
  installation of package ‘dplyr’ had non-zero exit status
ERROR: dependency ‘juicyjuice’ is not available for package ‘gt’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/gt’
Warning in install.packages :
  installation of package ‘gt’ had non-zero exit status
ERROR: dependency ‘gt’ is not available for package ‘gtsummary’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/gtsummary’
Warning in install.packages :
  installation of package ‘gtsummary’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/2k/0wblmqgn5_zd2hwclks8cy9w0000gn/T/Rtmp6ByUwe/downloaded_packages’
> library("gtsummary")
Error in library("gtsummary") : there is no package called ‘gtsummary’```

I've tried updating all packages and restarting R with no success in resolving it.
This is as far as my knowledge goes.
Help?

Indicates that the Xcode CLI utility is missing from Sonoma installation, in turn indicating that the package requires compilation or you passed on the binary version and voluntarily signed up for something your set up is incapable of doing.

The fix for the one

install.packages(“gtsummary”, ask = FALSE)

and for the other, from a terminal session

xcode-select --install

which might require installing XCode from the App Store.

Most users are better off avoiding compiling because further problems arise regularly in troubleshooting yet further missing pieces in the form of system dependencies which in turn requires a whole separate toolkit, such as brew. None of these obstacles are insurmountable, but neither are they what should be expected from doing data science. It’s kind of like when autos first arrived having to be a mechanic if you wanted to drive.

I was unable to find a package called gitsummary on CRAN. Do you mean gtsummary, or is gitsummary from another source?

1 Like

I did mean "gtsummary", spelling error on my end! Fixed it on the prompt to reflect the correct one

Tried xcode—select -- install and added XCode from App Store, that cleared a lot of errors, but still getting this:

also installing the dependencies ‘V8’, ‘juicyjuice’, ‘gt’

Warning in install.packages :
  unable to access index for repository http://mirrors.nics.utk.edu/cran/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'http://mirrors.nics.utk.edu/cran/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘V8’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source packages ‘V8’, ‘juicyjuice’, ‘gt’, ‘gtsummary’

trying URL 'http://mirrors.nics.utk.edu/cran/src/contrib/V8_4.4.0.tar.gz'
Content type 'application/x-gzip' length 678520 bytes (662 KB)
==================================================
downloaded 662 KB

trying URL 'http://mirrors.nics.utk.edu/cran/src/contrib/juicyjuice_0.1.0.tar.gz'
Content type 'application/x-gzip' length 1121080 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'http://mirrors.nics.utk.edu/cran/src/contrib/gt_0.10.0.tar.gz'
Content type 'application/x-gzip' length 2244763 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

trying URL 'http://mirrors.nics.utk.edu/cran/src/contrib/gtsummary_1.7.2.tar.gz'
Content type 'application/x-gzip' length 1920516 bytes (1.8 MB)
==================================================
downloaded 1.8 MB

* installing *source* package ‘V8’ ...
** package ‘V8’ successfully unpacked and MD5 sums checked
** using staged installation
Found C++17 compiler: clang++ -arch arm64
Using autobrew bundle: v8-11.7.439.14-universal.tar.xz
** libs
rm -f V8.so RcppExports.o bindings.o
clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/2k/0wblmqgn5_zd2hwclks8cy9w0000gn/T/Rtmp06Ri5W/R.INSTALL4d4318984de/V8/.deps/include -DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/private/var/folders/2k/0wblmqgn5_zd2hwclks8cy9w0000gn/T/Rtmp06Ri5W/R.INSTALL4d4318984de/V8/.deps/include -DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c bindings.cpp -o bindings.o
clang++ -arch arm64 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o V8.so RcppExports.o bindings.o -L/private/var/folders/2k/0wblmqgn5_zd2hwclks8cy9w0000gn/T/Rtmp06Ri5W/R.INSTALL4d4318984de/V8/.deps/lib -lv8_monolith -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: -single_module is obsolete
ld: warning: -multiply_defined is obsolete
installing to /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/00LOCK-V8/00new/V8/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
sh: line 1:  1515 Trace/BPT trap: 5       R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/2k/0wblmqgn5_zd2hwclks8cy9w0000gn/T//Rtmp06Ri5W/file4d43ea1959e'
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/V8’
Warning in install.packages :
  installation of package ‘V8’ had non-zero exit status
ERROR: dependency ‘V8’ is not available for package ‘juicyjuice’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/juicyjuice’
Warning in install.packages :
  installation of package ‘juicyjuice’ had non-zero exit status
ERROR: dependency ‘juicyjuice’ is not available for package ‘gt’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/gt’
Warning in install.packages :
  installation of package ‘gt’ had non-zero exit status
ERROR: dependency ‘gt’ is not available for package ‘gtsummary’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/gtsummary’
Warning in install.packages :
  installation of package ‘gtsummary’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/2k/0wblmqgn5_zd2hwclks8cy9w0000gn/T/RtmpRRDLEb/downloaded_packages’

It seems that your CRAN mirror does not have a binary V8 package and compilation does not work for you. I suggest you use the first CRAN mirror in the list, if you can:

options(repos = "https://cloud.r-project.orrg")
1 Like

This topic was automatically closed 42 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.