Import installed python packages into the environment

import_py_pkgs(
  py_pkgs = c("scipy", "pandas"),
  envir = NULL,
  path = get_py_path(),
  delay_load = FALSE
)

Arguments

py_pkgs

vector of python packages to install

envir

environment to load the main modules into

path

The path from which the module should be imported.

delay_load

Logical (TRUE/FALSE). Delay loading the module until it is first used? If FALSE, the module will be loaded immediately. See reticulate::import() for more information.

Details

This function loops through py_pkgs, and does the equivalent of the following, and assigns it to the parent environment:

scipy <- reticulate::import("scipy")

or

scipy <- reticulate::import_from_path("scipy", path = "path/to/module")