create_condaenv_seuratextend: Create the 'seuratextend' Conda Environment

View source: R/Python.R

create_condaenv_seuratextendR Documentation

Create the 'seuratextend' Conda Environment

Description

Initializes a Conda environment named 'seuratextend' which includes all necessary Python packages for running 'scVelo', 'Palantir', and 'CellRank' via 'SeuratExtend'. This function is ideal for users setting up their analytical environment for the first time or those who need to ensure they have a compatible environment setup.

Usage

create_condaenv_seuratextend(force = FALSE)

Arguments

force

Logical; if TRUE, removes any existing 'seuratextend' environment before creating a new one. Default is FALSE. Use this parameter to force recreation of the environment if a previous installation was interrupted or incomplete.

Details

When you run functions from 'SeuratExtend' that require Python integrations, such as 'scVelo', 'Palantir', or 'CellRank', you might need a specific set of Python packages installed. This function facilitates the setup of a Conda environment specifically tailored for these tools, managed through 'reticulate'.

The environment setup is automatic and checks your operating system to configure appropriately. It is currently supported and tested on: * Windows (Intel/AMD processors) * macOS (both Intel-based and Apple Silicon/M-series processors) * Linux (Ubuntu 20.04)

The function automatically detects Apple Silicon (M1/M2/M3/M4) Macs and uses the appropriate configuration.

## Known macOS Issues and Workarounds

Users on macOS may encounter specific issues due to memory management between R and Python:

* **Intel Macs**: When using R Markdown in RStudio with Python tools like scVelo, the R session may crash. To work around this issue, use regular .R script files instead of R Markdown files.

* **Apple Silicon (M1/M2/M3/M4)**: If any R objects are loaded in the session before calling Python functions (particularly operations like PCA on AnnData objects), the R session may crash. This is a known memory management issue between R and Python on macOS.

**Solution**: Start with a fresh R session and call 'activate_python()' at the beginning of your workflow before loading any R objects. This initializes the Python environment first and prevents memory-related crashes. After this initialization, all scVelo-related functions should work properly.

If force=TRUE is used, any existing 'seuratextend' environment will be removed before creating a new one. This can be useful when: * A previous installation was interrupted * Required dependencies were not properly installed * You need to reset the environment to a clean state * You encounter persistent environment-related errors

Value

Does not return any value; it creates and configures a new Conda environment.

Examples

## Not run: 
# Standard installation
create_condaenv_seuratextend()

# Force recreation of the environment
create_condaenv_seuratextend(force = TRUE)

## End(Not run)

huayc09/SeuratExtend documentation built on July 5, 2025, 1:41 a.m.