Skip to content

Commit 122214e

Browse files
committed
add python path info
1 parent 1a49ee9 commit 122214e

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

R/utils.R

+27-11
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ get_seed <- function() {
146146
sample.int(
147147
n = 2^30,
148148
size = 1
149-
)
149+
)
150150
}
151151

152152
# does a pointer exist (as a named object) and is it from the current session
@@ -680,8 +680,8 @@ as_tf_function <- function(r_fun, ...) {
680680
sub_dag <- dag_class$new(targets)
681681

682682
# TF1/2 check remove
683-
# `get_default_graph()` doesn't work with either eager execution or
684-
# `tf.function`.
683+
# `get_default_graph()` doesn't work with either eager execution or
684+
# `tf.function`.
685685
# use the default graph, so that it can be overwritten when this is called?
686686
# alternatively fetch from above, or put it in greta_stash?
687687
# sub_dag$tf_graph <- tf$compat$v1$get_default_graph()
@@ -879,10 +879,10 @@ check_if_software_available <- function(software_available,
879879
}
880880

881881
compare_version_vec <- Vectorize(
882-
FUN = compareVersion,
883-
vectorize.args = "b",
884-
SIMPLIFY = TRUE
885-
)
882+
FUN = compareVersion,
883+
vectorize.args = "b",
884+
SIMPLIFY = TRUE
885+
)
886886

887887
#' Greta Situation Report
888888
#'
@@ -898,6 +898,8 @@ compare_version_vec <- Vectorize(
898898
#' }
899899
greta_sitrep <- function(){
900900

901+
config_info <- reticulate::py_config()
902+
901903
cli::cli_h1("R")
902904
cli::cli_ul("version: {.val {getRversion()}}")
903905
cli::cli_ul("path: {R.home()}")
@@ -923,6 +925,8 @@ greta_sitrep <- function(){
923925
check_if_software_available(software_available = have_greta_conda_env(),
924926
software_name = "greta conda environment")
925927

928+
show_greta_conda_env_path()
929+
926930
software_available <- c(
927931
python = have_python(),
928932
tf = have_tf(),
@@ -968,6 +972,18 @@ greta_sitrep <- function(){
968972

969973
}
970974

975+
show_greta_conda_env_path <- function(){
976+
if (!have_greta_conda_env()){
977+
cli::cli_ul("path: no conda env found for {.var greta-env-tf2}")
978+
}
979+
980+
py_cl <- reticulate::conda_list()
981+
which_greta_env <- which(py_cl$name == "greta-env-tf2")
982+
greta_env_path <- py_cl$python[which_greta_env]
983+
cli::cli_ul("path: {greta_env_path}")
984+
985+
}
986+
971987
# adapted from https://github.com/rstudio/tensorflow/blob/main/R/utils.R
972988
is_mac_arm64 <- function() {
973989
if (nzchar(Sys.getenv("GRETA_M1_MESSAGE_TESTING"))) {
@@ -1053,8 +1069,8 @@ check_dag_introduces_new_variables <- function(dag, mcmc_dag) {
10531069
}
10541070

10551071
check_targets_stochastic_and_not_sampled <- function(
1056-
target,
1057-
mcmc_dag_variables
1072+
target,
1073+
mcmc_dag_variables
10581074
) {
10591075
target_nodes <- lapply(target, get_node)
10601076
target_node_names <- extract_unique_names(target_nodes)
@@ -1144,7 +1160,7 @@ node_type_colour <- function(type){
11441160
data = cli::col_green(type),
11451161
operation = cli::col_cyan(type),
11461162
distribution = cli::col_yellow(type)
1147-
)
1163+
)
11481164

11491165
switch_cols
11501166
}
@@ -1185,7 +1201,7 @@ are_null <- function(x){
11851201
x,
11861202
is.null,
11871203
FUN.VALUE = logical(1)
1188-
)
1204+
)
11891205
}
11901206

11911207
are_greta_array <- function(x){

0 commit comments

Comments
 (0)