diff --git a/R/python-install.R b/R/python-install.R index 3a4e00e..0fafe49 100644 --- a/R/python-install.R +++ b/R/python-install.R @@ -217,8 +217,7 @@ install_environment <- function( "PyArrow", "grpcio", "google-api-python-client", - "grpcio_status", - "rpy2" + "grpcio_status" ) if (add_torch && install_ml) { diff --git a/R/sparklyr-spark-apply.R b/R/sparklyr-spark-apply.R index afdbdb9..afc7cdc 100644 --- a/R/sparklyr-spark-apply.R +++ b/R/sparklyr-spark-apply.R @@ -14,10 +14,7 @@ spark_apply.tbl_pyspark <- function( arrow_max_records_per_batch = NULL, auto_deps = FALSE, ...) { - py_check_installed( - libraries = "rpy2", - msg = "Requires an additional Python library" - ) + rpy2_installed() cli_div(theme = cli_colors()) if (!is.null(packages)) { cli_abort("`packages` is not yet supported for this backend") @@ -209,3 +206,11 @@ sa_function_to_string <- function( } ret } + +rpy2_installed <- function(envname = NULL) { + py_check_installed( + envname = envname, + libraries = "rpy2", + msg = "Required 'rpy2' Python library is missing" + ) +}