Skip to contents

The process-sandbox twin of repro_install_deps(): installs each non-stdlib dependency via pip install --target <lib_dir>, so a run does not touch the host's own site-packages. A manifest-pinned requirement (ref non-NA — see repro_dependencies_py()) is installed by that exact requirement text (honouring the pin); an import-only package (ref NA) is installed by bare name, latest version. Installing runs a package's own build/setup code, so this is part of the gated execute phase, same as its R counterpart.

Usage

repro_install_deps_py(
  install_deps,
  lib_dir,
  python_bin = "python",
  timeout = 300
)

Arguments

install_deps

the module's Python install_deps frame (package, source, ref), base/stdlib rows already excluded

lib_dir

the throwaway install target (created if absent); passed to pip install --target

python_bin

the python executable to invoke -m pip with (default "python", resolved via Sys.which() at call time so a missing interpreter fails with a clear message rather than a cryptic pip error)

timeout

per-pip install timeout in seconds (default 300)

Value

a data frame with package, source, installed (logical), message (error text/pip stderr on failure, else ""), via_archive (always FALSE — pip has no CRAN-Archive-style fallback registry to retry against), and category (always NA — pip's own error text is not classified into categories the way .repro_classify_install_message() does for R's install.packages()/BiocManager error shapes) — same column SET as repro_install_deps() so callers do not need to branch on which language ran.

Examples

if (FALSE) { # \dontrun{
# needs Python; installs packages with pip into a throwaway folder
deps <- repro_dependencies_py("import numpy as np")
repro_install_deps_py(deps, file.path(tempdir(), "pylib"))
} # }