0

when trying to install Hmisc in R using renv I get the message underneath. Could somebody help me please?

I'm using:

R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics", with
RStudio 2022.02.3 Build 492, using a 
Platform: x86_64-apple-darwin17.0 (64-bit), and  
renv 0.14.0

--

Installing 'Hmisc' ...
[1/6] Installing Formula...
Retrieving 'https://cran.rstudio.com/bin/macosx/contrib/4.2/Formula_1.2-4.tgz' ...
    OK [file is up to date]
Installing Formula [1.2-4] ...
    FAILED

Error in if (eval(cond, envir = environment(dot))) return(eval(expr, envir = environment(dot))) :  the condition has length > 1

Calls: sourceWithProgress ... renv_scope_install -> renv_scope_install_macos -> case

In addition: Warning message: 
In system2(R(), args, stdout = TRUE, stderr = TRUE) : running command ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CC 2>&1' had status 1
Traceback (most recent calls last):

15: sourceWithProgress(script = "/var/folders/y9/8c6qs4hj6pq1nnv725g7gbxw0000gn/T/9878-ce12-709e-35eb", 
        encoding = "UTF-8", con = stdout(), importRdata = NULL, exportRdata = NULL)

14: eval(statements[[idx]], envir = sourceEnv)

13: eval(statements[[idx]], envir = sourceEnv)

12: renv::install("Formula")

11: renv_install_impl(records)

10: renv_install_staged(records)

 9: renv_install_default(records)

 8: handler(package, renv_install_package(record))

 7: renv_install_package(record)

 6: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
        vwritef("\tFAILED")
        writef(e$output)
    })

 5: renv_install_package_impl(record)

 4: r_cmd_install(package, path)

 3: renv_scope_install()

 2: renv_scope_install_macos(.envir)

 1: case(matches("/usr/bin/clang") ~ TRUE, matches("clang") ~ Sys.which("clang") == 
        "/usr/bin/clang", FALSE)

Execution halted
MrFlick
  • 195,160
  • 17
  • 277
  • 295
menarest
  • 3
  • 4
  • Can you please share the output of `system2(renv:::R(), "CMD config CC")`? It seems like R is reporting the C compiler used by your R installation in a way that `renv` is not expecting. – Kevin Ushey Jun 09 '22 at 20:52
  • If you recently updated macOS, you might also need to reinstall command line tools. Use `xcode-select --install` from the command line to re-install them. – Kevin Ushey Jun 11 '22 at 03:27
  • thanks for answering, here is the report from: system2(renv:::R(), "CMD config CC"): clang -mmacosx-version-min=10.13. Indeed, I recently updated my Macbook. I run xcode-select --install and then tried to install 'Hmisc' again and now it works! thanks you so much! – menarest Jun 13 '22 at 10:55

1 Answers1

1

This part of the stack trace:

 < ... >
 3: renv_scope_install()

 2: renv_scope_install_macos(.envir)

 1: case(matches("/usr/bin/clang") ~ TRUE, matches("clang") ~ Sys.which("clang") == 
        "/usr/bin/clang", FALSE)

suggests that something went wrong when renv was trying to query information about the system compiler.

Somewhat surprisingly, whenever one upgrades to a new version of macOS, any existing command line tools (CLT) installation will be removed, and needs to be manually re-installed. renv relies on these command line tools being available when querying information about the system's installation capabilities, so re-installing command line tools with:

xcode-select --install

should alleviate the issue.

I've also made some changes in the development version of renv to ensure that this situation is handled and reported better.

Kevin Ushey
  • 20,530
  • 5
  • 56
  • 88