is_python_package_installed: Determine if a Python package is installed

View source: R/is_python_package_installed.R

is_python_package_installedR Documentation

Determine if a Python package is installed

Description

Determine if a Python package is installed

Usage

is_python_package_installed(
  package_name,
  ormr_folder_name = get_default_ormr_folder_name(),
  python_version = get_default_python_version(),
  verbose = FALSE
)

Arguments

package_name

the Python package's name

ormr_folder_name

can be either python3 or the name of the folder where ormr installs all Python environments and packages.

python_version

the version of Python used. Use get_default_python_version to get the default Python version.

verbose

the verbosity of a function. Set to TRUE for more output. Use check_verbose to detect if this argument is valid.

Value

nothing

Author(s)

Richèl J.C. Bilderbeek

Examples

if (plinkr::is_on_ci()) {

  ormr_folder_name <- create_default_conda_env()

  # setuptools is installed with the Conda environment
  is_python_package_installed(
    ormr_folder_name = ormr_folder_name,
    package_name = "setuptools"
  )

  # scipy is not installed with the Conda environment
  # Use 'ormr::install_python_packages' to install scipy
  is_python_package_installed(
    ormr_folder_name = ormr_folder_name,
    package_name = "scipy"
  )

}

richelbilderbeek/ormr documentation built on May 23, 2022, 1:15 p.m.