Skip to content

Commit

Permalink
ARROW-7919: [R] install_arrow() should conda install if appropriate
Browse files Browse the repository at this point in the history
Closes #6709 from nealrichardson/r-conda-install-arrow

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
  • Loading branch information
nealrichardson authored and wesm committed Mar 25, 2020
1 parent 71fce1a commit cd33bbb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
25 changes: 16 additions & 9 deletions r/R/install-arrow.R
Expand Up @@ -36,7 +36,7 @@
#' faster, but there is a risk of version mismatch.
#' @param minimal logical: If building from source, should we build without
#' optional dependencies (compression libraries, for example)? Default is
#' `FALSE`.
#' `FALSE`.
#' @param repos character vector of base URLs of the repositories to install
#' from (passed to `install.packages()`)
#' @param ... Additional arguments passed to `install.packages()`
Expand All @@ -51,14 +51,21 @@ install_arrow <- function(nightly = FALSE,
minimal = Sys.getenv("LIBARROW_MINIMAL", FALSE),
repos = getOption("repos"),
...) {
if (tolower(Sys.info()[["sysname"]]) %in% c("windows", "darwin", "linux")) {
Sys.setenv(
LIBARROW_DOWNLOAD = "true",
LIBARROW_BINARY = binary,
LIBARRWOW_MINIMAL = minimal,
ARROW_USE_PKG_CONFIG = use_system
)
install.packages("arrow", repos = arrow_repos(repos, nightly), ...)
sysname <- tolower(Sys.info()[["sysname"]])
conda <- isTRUE(grepl("conda", R.Version()$platform))

if (sysname %in% c("windows", "darwin", "linux")) {
if (conda && !nightly && (sysname %in% c("darwin", "linux"))) {
system("conda install -y -c conda-forge --strict-channel-priority r-arrow")
} else {
Sys.setenv(
LIBARROW_DOWNLOAD = "true",
LIBARROW_BINARY = binary,
LIBARRWOW_MINIMAL = minimal,
ARROW_USE_PKG_CONFIG = use_system
)
install.packages("arrow", repos = arrow_repos(repos, nightly), ...)
}
if ("arrow" %in% loadedNamespaces()) {
# If you've just sourced this file, "arrow" won't be (re)loaded
reload_arrow()
Expand Down
2 changes: 1 addition & 1 deletion r/README.md
Expand Up @@ -57,7 +57,7 @@ install_arrow()

Conda users on Linux and macOS can install `arrow` from conda-forge with

conda install -c conda-forge r-arrow
conda install -c conda-forge --strict-channel-priority r-arrow

## Installing a development version

Expand Down
2 changes: 1 addition & 1 deletion r/vignettes/install.Rmd
Expand Up @@ -24,7 +24,7 @@ The intended audience for this document is `arrow` R package users on Linux, not
If you're contributing to the Arrow project,
you'll probably want to manage your C++ installation more directly.
Note also that if you use `conda` to manage your R environment, this document does not apply.
You can `conda install -c conda-forge r-arrow` and you'll get the latest official
You can `conda install -c conda-forge --strict-channel-priority r-arrow` and you'll get the latest official
release of the R package along with any C++ dependencies.

# Installation basics
Expand Down

0 comments on commit cd33bbb

Please sign in to comment.