Skip to content

This function checks for the Python interpreter's location (either specified by the user or automatically located), compares it with the current R session's Python setting, installs a specified Python package using the identified Python interpreter, and returns the package version and installation environment.

Usage

install_python_package(
  package_name,
  package_version = NULL,
  python_path = Sys.which("python3")
)

Arguments

package_name

The name of the Python package to install.

package_version

The version of the Python package to install. If NULL, the latest version is installed.

python_path

The path to the Python interpreter to be used for installation. If not provided, it defaults to the result of Sys.which("python3").

Value

A list containing the package name, installed version, and the path to the Python interpreter used for installation.

Examples

if (FALSE) { # \dontrun{
install_python_package(package_name ="flair", package_version ="0.12")
} # }