python_requirements: Python Requirements for transforEmotion

View source: R/reticulate_env.R

python_requirementsR Documentation

Python Requirements for transforEmotion

Description

Returns the Python requirements that transforEmotion installs, in requirements.txt format. Use it to build a fixed Python environment, for example in a container image, and point transforEmotion at it with the TRANSFOREMOTION_PYTHON environment variable (see Details).

Usage

python_requirements(
  extras = character(),
  gpu = FALSE,
  sysname = Sys.info()[["sysname"]],
  machine = Sys.info()[["machine"]]
)

Arguments

extras

Character vector of optional feature sets to include; see setup_modules.

gpu

Logical. Use the CUDA build of PyTorch (Linux and Windows) instead of the CPU build.

sysname, machine

Target operating system and architecture, as returned by Sys.info(). Default to the current machine.

Details

The PyTorch requirements are direct wheel URLs built for Python 3.12, so the environment must use Python 3.12.

When TRANSFOREMOTION_PYTHON is set to a Python executable, transforEmotion uses that interpreter and does not install anything. This is the route for read-only environments such as Apptainer images, where uv cannot write to its cache.

Value

A character vector of requirement specifiers.

Examples

# Requirements for a CPU environment with the rag() packages
python_requirements(extras = "rag")

## Not run: 
# Write a requirements file and build the environment with uv (shell):
#   uv venv --python 3.12 /opt/te-venv
#   uv pip install --python /opt/te-venv/bin/python -r requirements.txt
writeLines(python_requirements(extras = "rag"), "requirements.txt")

## End(Not run)


transforEmotion documentation built on Oct. 26, 2026, 5:07 p.m.