
Point spharmlithic at an existing Python environment
Source: R/install_python.R
use_spharmlithic_python.RdUse this if you already have a conda environment with the required
Python packages (e.g. an environment created by your analysis project's
environment.yml, or a Docker image). Performs a lightweight check
that the required packages are importable.
Value
Invisibly, a list with elements envname, python (path to
the active Python executable), and available (named logical
vector of required-package availability).
Details
This function should be called before any spharm_from_directions()
or spharm_from_meshes() call, and ideally before the package's first
use in an R session.
The envname argument is resolved in the following order:
Conda environment — if
envnamematches a name returned byreticulate::conda_list(),reticulate::use_condaenv()is called.Virtualenv — if
reticulate::virtualenv_exists(envname)isTRUE,reticulate::use_virtualenv()is called.Python executable path — if
file.exists(envname)isTRUE,reticulate::use_python()is called with the path directly.
If none of the above match, the function stops with an informative
error. In all cases required = TRUE is passed to the underlying
reticulate call, so any conflict with an already-initialised Python
session will raise an error rather than silently use a different
interpreter.