This function ensures that a suitable Python environment (virtualenv or conda) is available and that 'torch' and 'numpy' or 'tinygrad' are installed within it. Users should run this once before using functions that rely on PyTorch.
Character string. The method to use for environment creation. Can be "conda" (default) or "virtualenv".
Character string. The name of the Python environment to create/use. Defaults to "FastPCA".
Character string. The Python version to use (e.g., "3.9"). Defaults to "3.9". It's recommended to stick to well-supported versions.
character string of the backend to use. Either 'torch', 'tinygrad', or 'all'. Defaults to 'all' to install all packages into the environment. Currently only pytorch. Flag is ignored
boolean for whether to install cuda toolkit to leverage the cuda backend
Additional arguments passed to reticulate::virtualenv_create()
or reticulate::conda_create().
Invisibly returns TRUE if setup is successful, FALSE otherwise.
if (FALSE) { # \dontrun{
#for conda
FastPCA::setup_py_env(method = "conda")
#reticulate virtualenv:
FastPCA::setup_py_env()
} # }