Skip to content

Commit c1ea8b9

Browse files
committed
Add env var for disabling
1 parent 704729d commit c1ea8b9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
variables via unpacking (#1844).
3030

3131
- reticulate now warns when `py_require()`d packages are not found in the selected
32-
Python virtual environment (#1850).
32+
Python virtual environment. This behavior can be disabled by setting the environment variable `RETICULATE_CHECK_REQUIRED_PACKAGES=0` (#1850).
3333

3434
# reticulate 1.43.0
3535

R/package.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,14 @@ initialize_python <- function(required_module = NULL, use_environment = NULL) {
290290
py_allow_threads_impl(TRUE)
291291
}
292292
}
293-
294293
if (nzchar(config$virtualenv)) {
295-
tryCatch(check_virtualenv_required_packages(config), error = function(e) {
296-
# ignore errors, this should never block initialization
297-
})
294+
check_required_packages <- Sys.getenv("RETICULATE_CHECK_REQUIRED_PACKAGES", "true")
295+
check_required_packages <- tolower(check_required_packages) %in% c("true", "1", "yes")
296+
if (check_required_packages) {
297+
tryCatch(check_virtualenv_required_packages(config), error = function(e) {
298+
# ignore errors, this should never block initialization
299+
})
300+
}
298301
}
299302

300303
# return config

0 commit comments

Comments
 (0)