nemo_rl.utils.venvs#

Module Contents#

Functions#

create_local_venv

Create a virtual environment using uv and execute a command within it.

Data#

API#

nemo_rl.utils.venvs.dir_path#

‘dirname(…)’

nemo_rl.utils.venvs.git_root#

‘abspath(…)’

nemo_rl.utils.venvs.DEFAULT_VENV_DIR#

‘join(…)’

nemo_rl.utils.venvs.logger#

‘getLogger(…)’

nemo_rl.utils.venvs.create_local_venv(py_executable: str, venv_name: str) str[source]#

Create a virtual environment using uv and execute a command within it.

The output can be used as a py_executable for a Ray worker assuming the worker nodes also have access to the same file system as the head node.

This function is cached to avoid multiple calls to uv to create the same venv, which avoids duplicate logging.

Parameters:
  • py_executable (str) – Command to run with the virtual environment (e.g., “uv.sh run –locked”)

  • venv_name (str) – Name of the virtual environment (e.g., “foobar.Worker”)

Returns:

Path to the python executable in the created virtual environment

Return type:

str