From 4a11c6d65c63e189fc6fa176017f9c1695002603 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Wed, 13 Mar 2024 08:27:11 -0400 Subject: [PATCH 1/3] don't discover python2 in `py_discover_config()` --- R/config.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/config.R b/R/config.R index d5b9cbad4..da97abdc7 100644 --- a/R/config.R +++ b/R/config.R @@ -385,13 +385,13 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) { # if we have a required module ensure it's satisfied. # also check architecture (can be an issue on windows) - has_python_gte_27 <- as.numeric_version(config$version) >= "2.7" + has_python_gte_36 <- as.numeric_version(config$version) >= "3.6" has_compatible_arch <- !is_incompatible_arch(config) has_preferred_numpy <- !is.null(config$numpy) && config$numpy$version >= "1.6" if (has_compatible_arch && has_preferred_numpy) - valid_python_versions <- c(valid_python_versions, python_version) + append(valid_python_versions) <- python_version has_required_module <- is.null(config$required_module) || !is.null(config$required_module_path) - if (has_python_gte_27 && has_compatible_arch && has_preferred_numpy && has_required_module) + if (has_python_gte_36 && has_compatible_arch && has_preferred_numpy && has_required_module) return(config) } From f4db45fa3e5dba16da357d6313347ac84a63b8e8 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Wed, 13 Mar 2024 08:39:26 -0400 Subject: [PATCH 2/3] comment --- R/config.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/config.R b/R/config.R index da97abdc7..d379cd11c 100644 --- a/R/config.R +++ b/R/config.R @@ -306,6 +306,7 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) { ## In other words, ## - no use_python(), use_virtualenv(), use_condaenv() ## - no RETICULATE_PYTHON, RETICULATE_PYTHON_ENV, or RETICULATE_PYTHON_FALLBACK env vars + ## - no existing venv in the current working directory named: venv .venv virtualenv or .virtualenv ## - no env named 'r-bar' if there was a call like `import('foo', delay_load = list(environment = "r-bar"))` ## - no env named 'r-foo' if there was a call like `import('foo')` ## - we're not running under an already activated venv (i.e., no VIRTUAL_ENV env var) From 789967355c52afe2e3241c003fbcec418c8b4183 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Wed, 13 Mar 2024 08:44:32 -0400 Subject: [PATCH 3/3] add NEWS --- NEWS.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index ff06c4199..2a47e6cf5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,19 +1,22 @@ # reticulate (development version) -- `iterate(simplify=TRUE)` rewritten in C for speed improvements. +- `iterate(simplify=TRUE)` rewritten in C for speed improvements. -- Fixed hang encountered (sometimes) when attempting to call `iterate()` +- Fixed hang encountered (sometimes) when attempting to call `iterate()` on an exhausted `py_iterator()` object multiple times. - Update for Pandas 2.2 deprecation of `Index.format()` (#1537, #1538). - Updates for CRAN R-devel (R 4.4). +- Fixed an issue where `py_discover_config()` would discover `python` (v2) on the PATH + in preference of `python3` on the PATH. (#1547) + # reticulate 1.35.0 - Subclassed Python list and dict objects are no longer automatically converted to R vectors. Additionally, the S3 R `class` attribute for Python objects is - now constructed using the Python `type(object)` directly, rather than from the + now constructed using the Python `type(object)` directly, rather than from the `object.__class__` attribute. See #1531 for details and context. - R external pointers (EXTPTRSXP objects) now round-trip through @@ -29,7 +32,7 @@ - Added support for partially unexpanded variables like `$USER` in `XDG_DATA_HOME` and similar (#1513, #1514) -## Knitr Python Engine Changes: +## Knitr Python Engine Changes: - The knitr python engine now formats captured python exceptions to include the exception type and any exception notes when chunk options @@ -46,7 +49,7 @@ where matplotlib was first imported would be the wrong size (reported in #1523, fixed in #1530) -- Fixed an issue where the knitr engine would not correctly display altair +- Fixed an issue where the knitr engine would not correctly display altair compound charts if more than one were present in a document (#1500, #1532). # reticulate 1.34.0 @@ -160,7 +163,7 @@ - The knitr engine gains a `jupyter_compat` option, enabling reticulate to better match the behavior of Jupyter. When this chunk option is set to `TRUE`, only the return value from the last - expression in a chunk is auto-printed. + expression in a chunk is auto-printed. (#1391, #1394, contributed by @matthew-brett) - The knitr engine now more reliably detects and displays matplotlib