To reproduce, try running the following code on a version with R without libcurl support (e.g. the Snow Leopard build of R 3.2.1):
> suppressMessages(library(BiocInstaller)) Error : .onLoad failed in loadNamespace() for 'BiocInstaller', details: call: url(paste0(.protocol(), "//bioconductor.org/BiocInstaller.dcf")) error: https:// URLs are not supported Error: package or namespace load failed for ‘BiocInstaller’
The interaction occurs when 'BiocInstaller:::.protocol' attempts to ascertain whether `https://` or `http://` should be used. The implementation has:
con <- file(fl <- tempfile(), "a") on.exit(close(con)) sink(con, type = "message") tryCatch({ fcon <- file("https://bioconductor.org/index.html") on.exit(close(fcon), add = TRUE) readLines(fcon, 1L) }, error = function(e) { message(conditionMessage(e)) }) sink(type = "message") flush(con) useHTTPS <- length(readLines(fl)) == 0L PROTOCOL <<- if (useHTTPS) "https:" else "http:"
And that attempt to populate a message sink fails when executed within a suppressMessages()
context. Although the above example is artificial, most other examples may not be -- it's easy to imagine that the BiocInstaller namespace might be implicitly loaded deep within the bowels of some code; for example, 'packrat::snapshot()' will query 'BiocInstaller::biocinstallRepos()', and a user calling 'packrat::snapshot()' wrapped in 'suppressMessages()' will then see the BiocInstaller load error.
There are a lot of safer ways this check for https could be implemented:
1. Attempt to read a URL with known contents, and check for expected output.
2. Check 'capabilities("libcurl")'.
3. Check for a specific version of R.
Thanks,
Kevin
---
> sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-apple-darwin10.8.0 (64-bit) Running under: OS X 10.12 (unknown) 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] utils methods base loaded via a namespace (and not attached): [1] BiocInstaller_1.20.3 graphics_3.2.1 tools_3.2.1 grDevices_3.2.1 stats_3.2.1
I believe .onLoad failed in loadNamespace() for 'BiocInstaller' is related (although a reproducible example was not discovered there).