Skip to content

GH-40991: [R] Prefer r-universe, add a startup message - #41019

Merged
jonkeane merged 7 commits into
apache:mainfrom
jonkeane:macos_install_help
Apr 5, 2024
Merged

jonkeane merged 7 commits into
apache:mainfrom
jonkeane:macos_install_help

Conversation

@jonkeane

@jonkeane jonkeane commented Apr 4, 2024 •

Copy link
Copy Markdown
Member

Rationale for this change

If someone loads a version of Arrow on macOS with features disabled, warn them on startup that they can use install_arrow(). By default, prefer R-Universe in install_arrow()

What changes are included in this PR?

^^^

Are these changes tested?

Yes

Are there any user-facing changes?

Yes

This PR contains a "Critical Fix".

Comment thread r/DESCRIPTION
vctrs
Roxygen: list(markdown = TRUE, r6 = FALSE, load = "source")
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to back this out + the extra docs changes, but they were stale on main.

@github-actions

github-actions Bot commented Apr 4, 2024

Copy link
Copy Markdown

⚠️ GitHub issue #40991 has been automatically assigned in GitHub to PR creator.

Comment thread r/R/arrow-package.R
Comment on lines +185 to +186
try(
{

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styler apparently demands this now?. I can back it out if we don't like it, but came from make doc so we'll be fighting it if we do.

Comment thread r/R/arrow-package.R
}, silent = TRUE)
# On macOS binaries from CRAN can be hobbled. If on macOS, and features
# are disabled, advise that reinstalling might help
if (identical(tolower(Sys.info()[["sysname"]]), "darwin")) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also check and confirm that the package was installed from CRAN here too if we wanted to be extra sure. Though we will also need to confirm that Posit Public Package Manager isn't also hosting bad binaries too if we do that, but if we leave this as a check on all macs, we have a slightly less strong push to confirm all non-CRANs are building on their own

Comment thread r/R/install-arrow.R Outdated
minimal = Sys.getenv("LIBARROW_MINIMAL", FALSE),
verbose = Sys.getenv("ARROW_R_DEV", FALSE),
repos = getOption("repos"),
prefer_runiverse = TRUE,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the option profusion here, but I do think going to r-universe first here is actually a nice plan. We don't have to muck with swapping to only source builds on macOS in order to get libarrow (and then also if someone has a borked gcc setup that would error too).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you take my other suggestion, you don't need to touch this function (though cleaning up the autobrew references is probably worthwhile anyway) or arrow_repos().

Comment thread r/R/install-arrow.R
Comment on lines -79 to -94
# On the M1, we can't use the usual autobrew, which pulls Intel dependencies
apple_m1 <- grepl("arm-apple|aarch64.*darwin", R.Version()$platform)
# On Rosetta, we have to build without JEMALLOC, so we also can't autobrew
rosetta <- on_rosetta()
if (rosetta) {
Sys.setenv(ARROW_JEMALLOC = "OFF")
}
if (apple_m1 || rosetta) {
Sys.setenv(FORCE_BUNDLED_BUILD = "true")
}

opts <- list()
if (apple_m1 || rosetta) {
# Skip binaries (esp. for rosetta)
opts$pkgType <- "source"
} else if (isTRUE(binary)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the m1 detection isn't needed any more now that we have binaries for arm. The rosetta checking for jemalloc also probably can go away, since rosetta generally doesn't work (I'm happy to delete it too)

@jonkeane
jonkeane requested a review from nealrichardson April 4, 2024 23:41

@nealrichardson nealrichardson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. One suggestion that might simplify things a bit.

Comment thread r/R/arrow-package.R Outdated
packageStartupMessage(
paste(
"The repository you retrieved Arrow from did not include all of Arrow's features.",
"You can install a fully-featured version by running `arrow::install_arrow()`."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see this R-package-devel thread? https://stat.ethz.ch/pipermail/r-package-devel/2024q2/010624.html

TL;DR order of repos doesn't necessarily guarantee order of lookup. So it might be better here to just recommend install.packages("arrow", repos = "https://apache.r-universe.dev"). We know they already have the arrow package dependencies installed since they're loading it, so we don't need to keep on a CRAN in order to get dependencies to resolve.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right of course. Thanks!

Comment thread r/R/install-arrow.R Outdated
minimal = Sys.getenv("LIBARROW_MINIMAL", FALSE),
verbose = Sys.getenv("ARROW_R_DEV", FALSE),
repos = getOption("repos"),
prefer_runiverse = TRUE,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you take my other suggestion, you don't need to touch this function (though cleaning up the autobrew references is probably worthwhile anyway) or arrow_repos().

Comment thread r/R/arrow-package.R Outdated
)
}
}, silent = TRUE)
# On macOS binaries from CRAN can be hobbled. If on macOS, and features

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a bad idea to explain here why they're hobbled, just so we'll know in the future when we can remove this workaround.

Comment thread r/R/arrow-info.R
Comment on lines +142 to +143
# jemalloc is only included because it is sometimes disabled in our build process
blocklist <- c("lzo", "bz2", "brotli", "substrait", "jemalloc")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a little paranoid / silly, but we disable jemalloc in our own builds, and honestly if only jemalloc is off, but nothing else is, that's generally ok, so I would rather be less noisy so long as folks can read parquet

@jonkeane
jonkeane force-pushed the macos_install_help branch from 568a472 to 2513c31 Compare April 5, 2024 03:41

@nealrichardson nealrichardson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some final cleanup suggestions but otherwise LGTM.

Also need update the PR description to reflect the current scope of the changes.

Comment thread r/R/install-arrow.R Resolved
Comment thread r/R/install-arrow.R
Sys.setenv(ARROW_JEMALLOC = "OFF")
}
if (apple_m1 || rosetta) {
Sys.setenv(FORCE_BUNDLED_BUILD = "true")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably also about autobrew right?

Suggested change
Sys.setenv(FORCE_BUNDLED_BUILD = "true")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it is, but when I git blamed it wasn't clear that's the only reason for it. I can pull it out, but also we probably should just remove all of the rosetta building code entirely at some point since it's not really a supported setup. I'll add an issue to come back to this (+ various other places we have it)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread r/R/install-arrow.R Resolved

@thisisnic thisisnic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't reviewed in detail but +1 overall to doing this and getting it merged ahead of Monday's code freeze

jonkeane and others added 2 commits April 5, 2024 07:59
Co-authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Co-authored-by: Neal Richardson <neal.p.richardson@gmail.com>
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 3886cf1.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them.

vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…41019)

### Rationale for this change

If someone loads a version of Arrow on macOS with features disabled, warn them on startup that they can use `install_arrow()`. By default, prefer R-Universe in `install_arrow()` 

### What changes are included in this PR?

^^^

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes

**This PR contains a "Critical Fix".**
* GitHub Issue: apache#40991

Lead-authored-by: Jonathan Keane <jkeane@gmail.com>
Co-authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Jonathan Keane <jkeane@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants