jonkeane commented on a change in pull request #9896:
URL: https://github.com/apache/arrow/pull/9896#discussion_r607335099



##########
File path: r/R/arrow-package.R
##########
@@ -47,12 +47,27 @@
   }
 
   # Create these once, at package build time
-  dplyr_functions$dataset <- build_function_list(build_dataset_expression)
-  dplyr_functions$array <- build_function_list(build_array_expression)
-
+  if (arrow_available()) {
+    dplyr_functions$dataset <- build_function_list(build_dataset_expression)
+    dplyr_functions$array <- build_function_list(build_array_expression)
+  }
   invisible()
 }
 
+.onAttach <- function(libname, pkgname) {
+  if (!arrow_available()) {
+    msg <- paste(
+      'The Arrow C++ library is not available. To retry installation with 
debug output, run:',
+
+      '    install_arrow(verbose = TRUE)',
+
+      'See `vignette("install", package = "arrow")` for more guidance and 
troubleshooting.',

Review comment:
       I think this is a good general message. A few thoughts:
   
   * Should we refer to the arrow c++ as a dependency? I think that's a word 
that people with less experience might look for.
   * Should we mention that in typical installations the arrow c++ library is 
either bundled with the installation (e.g. our binaries/CRAN) or built as part 
of the package installation process. I can't think of a short and pithy way to 
say this, but what I think we _don't_ want is someone to think that this means 
they need to now go and `apt install arrow` or the like (that should work for 
releases as long as the versions match up, but there are lots of ways that 
could be wrong).
   * Is there any prohibition on offering the url 
https://arrow.apache.org/docs/r/articles/install.html it's the same content as 
the vignette, but I suspect more people are familiar with packagdown sites than 
they are with vignettes these days.
   
   This is separate from this message, but I wonder if we should have another 
message onload (ideally onload, only the first time like many of the tidyverse 
packages do) that tests for `codec_is_available("snappy")` (or all of the ones 
not in the minimal build) that gently nudges that in the case of linux you'll 
want to set libarrow_binary=true or libarrow_minimal=false to get a more fully 
featured build? I know that a few times when I was managing rstudio server on 
linux I installed arrow, thought everything was fine and then later someone had 
to bug me that snappy wasn't enabled anymore so I had to go back and install 
it. It's not a huge deal but getting it out of the way when I'm in the 
installing mindset would have been nice compared to finding out later and 
having to go back to it.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to