Skip to content

fix: factor execution env crashes when no conda environment is active - #1462

Open
chrisbatso wants to merge 1 commit into
microsoft:mainfrom
chrisbatso:fix/conda-free-factor-env
Open

fix: factor execution env crashes when no conda environment is active#1462
chrisbatso wants to merge 1 commit into
microsoft:mainfrom
chrisbatso:fix/conda-free-factor-env

Conversation

@chrisbatso

@chrisbatso chrisbatso commented Aug 30, 2026

Copy link
Copy Markdown

Problem

get_factor_env() in rdagent/components/coder/factor_coder/config.py unconditionally builds a conda-based environment:

if hasattr(conf, "python_bin"):
    env = LocalEnv(conf=(CondaConf(conda_env_name=os.environ.get("CONDA_DEFAULT_ENV"))))

hasattr(conf, "python_bin") is always True (python_bin is a declared settings field with a default), so on any host where the process is not running inside an activated conda environment, CONDA_DEFAULT_ENV is unset and CondaConf raises:

ValidationError: 1 validation error for CondaConf
conda_env_name
  Input should be a valid string [type=string_type, input_value=None, ...]

This makes rdagent fin_factor crash at loop 0 on any conda-less installation (e.g. a plain venv/uv setup on a fresh Ubuntu server), even though nothing about factor execution actually requires conda.

Fix

Keep the conda path when CONDA_DEFAULT_ENV is set; otherwise fall back to a LocalEnv whose bin_path is the current interpreter's own bin directory, so factor code runs with the environment RD-Agent itself was installed into.

Testing

Reproduced on Ubuntu 26.04 with RD-Agent installed in a uv-managed venv (no conda present): rdagent fin_factor crashed with the ValidationError above; with this patch, factor implementation, execution, and full qlib R&D loops (15 loops, multiple LLM backends) run to completion. The conda path is unchanged for users inside an activated env.

馃 Generated with Claude Code


馃摎 Documentation preview 馃摎: https://RDAgent--1462.org.readthedocs.build/en/1462/

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant