Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghao-njmu committed Dec 20, 2022
1 parent 68c56ca commit a83e486
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ PrepareEnv <- function(conda_binary = NULL, python_version = "3.8",
if (python_version < numeric_version("3.7.0") || python_version >= numeric_version("3.10.0")) {
stop("SCP currently only support python version 3.7-3.9!")
}

if (identical(conda, "auto")) {
conda <- find_conda()
}
conda <- find_conda()

if (!is.null(conda)) {
env_exist <- file.exists(paste0(reticulate:::conda_info(conda = conda)$conda_prefix, "/envs/SCP"))
} else {
Expand Down Expand Up @@ -344,7 +342,7 @@ conda_python <- function(envname = NULL, conda = "auto", all = FALSE) {
stop(sprintf(fmt, envname))
}
conda_envs <- reticulate::conda_list(conda = conda)
conda_envs <- conda_envs[grep(paste0(reticulate:::conda_info(conda = conda)$conda_prefix, "/envs/"), x = conda_envs$python), ]
conda_envs <- conda_envs[grep(paste0(reticulate:::conda_info(conda = conda)$conda_prefix, "/envs/"), x = conda_envs$python), , drop = FALSE]
env <- subset(conda_envs, conda_envs$name == envname)
if (nrow(env) == 0) {
stop("conda environment '", envname, "' not found")
Expand Down

0 comments on commit a83e486

Please sign in to comment.