Skip to content

Commit e6b1256

Browse files
authored
Update create_virtualenv.R
Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk>
1 parent 665d492 commit e6b1256

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

R/create_virtualenv.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@ install_acro <- function(envname = "r-acro", python = NULL, ...) {
1515
python <- Sys.which("python3")
1616
if (python == "") {
1717
python <- Sys.which("python")
18-
}
19-
if (python == "") {
20-
stop("Python not found in PATH. Please ensure Python is installed and accessible.")
18+
if (python == "") {
19+
stop("Python not found in PATH. Please ensure Python is installed and accessible.")
20+
}
2121
}
2222
}
23-
23+
2424
# create Python virtual environment
2525
reticulate::virtualenv_create(
2626
envname = envname,
2727
python = python,
2828
force = TRUE,
2929
packages = NULL
3030
)
31+
3132
# install Python acro
3233
reticulate::py_install(acro_package, envname = envname)
3334
}
@@ -43,11 +44,12 @@ create_virtualenv <- function(...) {
4344
if (python_path == "") {
4445
python_path <- Sys.which("python")
4546
}
46-
47+
4748
# ensure a virtual environment exists
4849
if (!reticulate::virtualenv_exists(acro_venv)) {
4950
install_acro(envname = acro_venv, python = python_path)
5051
}
52+
5153
# activate virtual environment
5254
reticulate::use_virtualenv(acro_venv, required = TRUE)
5355
}

0 commit comments

Comments
 (0)