Problem installing "devtools" and "rstan" package on mac (Catalina)

Unable to install devtool and rstan packages after installing Command Line Tools and HomeBrew. I also have followed the instructions on github website to download C++ compiler to install rstan but still no luck. Any help will me greatly appreciated!!

Warning messages:
1: In install.packages("devtools") :
installation of package ‘pkgload’ had non-zero exit status
2: In install.packages("devtools") :
installation of package ‘roxygen2’ had non-zero exit status
3: In install.packages("devtools") :
installation of package ‘devtools’ had non-zero exit status

Please show the complete error message you are getting, we don't have enough information to help you.

There are binary versions available but the source versions are
later:
binary source needs_compilation
pkgload 1.0.2 1.1.0 TRUE
roxygen2 7.1.0 7.1.1 TRUE
devtools 2.2.2 2.3.1 FALSE

Do you want to install from sources the packages which need compilation? (Yes/no/cancel) yes
installing the source packages ‘pkgload’, ‘roxygen2’, ‘devtools’

trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/pkgload_1.1.0.tar.gz'
Content type 'application/x-gzip' length 58046 bytes (56 KB)

downloaded 56 KB

trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/roxygen2_7.1.1.tar.gz'
Content type 'application/x-gzip' length 254118 bytes (248 KB)

downloaded 248 KB

trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/devtools_2.3.1.tar.gz'
Content type 'application/x-gzip' length 373604 bytes (364 KB)

downloaded 364 KB

  • installing source package ‘pkgload’ ...
    ** package ‘pkgload’ successfully unpacked and MD5 sums checked
    ** libs
    clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c unlock.c -o unlock.o
    clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o pkgload.so unlock.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
    installing to /Library/Frameworks/R.framework/Versions/3.5/Resources/library/pkgload/libs
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    Error: package or namespace load failed for ‘pkgload’:
    .onLoad failed in loadNamespace() for 'pkgload', details:
    call: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
    error: there is no package called ‘backports’
    Error: loading failed
    Execution halted
    ERROR: loading failed
  • removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/pkgload’
    ERROR: dependency ‘pkgload’ is not available for package ‘roxygen2’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/roxygen2’
    ERROR: dependencies ‘pkgload’, ‘roxygen2’ are not available for package ‘devtools’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/devtools’

The downloaded source packages are in
‘/private/var/folders/5p/6hnb9ms90zv0fxdrl8995gv40000gn/T/RtmpcOPcmH/downloaded_packages’
Warning messages:
1: In install.packages("devtools") :
installation of package ‘pkgload’ had non-zero exit status
2: In install.packages("devtools") :
installation of package ‘roxygen2’ had non-zero exit status
3: In install.packages("devtools") :
installation of package ‘devtools’ had non-zero exit status

The first issue you need to tackle is this one, you are missing a package dependency, try installing it first.

install.packages("backports")

Do you get any error message while doing so?

1 Like

That was the issue. I was able to install devtools and rstan after installing backports. Thank you so much for the help!!!

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

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