Skip to content

fix(ga_cli): use sys.executable instead of hardcoded 'python' to inherit venv environment#502

Open
desmonna wants to merge 1 commit into
lsdefine:mainfrom
desmonna:main
Open

fix(ga_cli): use sys.executable instead of hardcoded 'python' to inherit venv environment#502
desmonna wants to merge 1 commit into
lsdefine:mainfrom
desmonna:main

Conversation

@desmonna
Copy link
Copy Markdown
Contributor

Problem:

All subcommands in ga_cli/cli.py (gui, configure, hub, tui, tui2, cli, launch) use hardcoded "python" to start processes. This can cause sub-processes to use the system global Python instead of the currently active environment's Python when running in a virtual environment (venv/conda), and thus fail to find installed dependency packages.

Solution

Replace all "python" with sys.executable to ensure that child processes inherit the current Python interpreter path.

Changes

ga_cli/cli.py: 7 occurrences of "python" → sys.executable

Fixes #501

@shenhao-stu
Copy link
Copy Markdown
Contributor

感谢~不过 ga_cli/cli.py:142 已经在用 sys.executable 了:

  • 引入:e248aa8 feat: 添加跨平台 GA 命令行入口系统 (#329)
  • 后续目录改名:2381d48 refactor: rename command/ to ga_cli/ to avoid namespace collision

你 fork 的可能是更早的快照。先关掉这条~

@desmonna
Copy link
Copy Markdown
Contributor Author

感谢~不过 ga_cli/cli.py:142 已经在用 sys.executable 了:

  • 引入:e248aa8 feat: 添加跨平台 GA 命令行入口系统 (#329)
  • 后续目录改名:2381d48 refactor: rename command/ to ga_cli/ to avoid namespace collision

你 fork 的可能是更早的快照。先关掉这条~

我fork的是昨天的仓库,算是比较新的。主要是昨天agent窗口执行任务时提示subagent缺少依赖而跳过任务,我发现142行 pip install 用 sys.executable ,但是前面第51行 —— 启动GUI却用硬编码 "python"。fork 出的子进程用的是 "python"(PATH 上的系统 Python),系统 Python 没有装那些依赖 → 报错缺包。所以才针对这个问题做了修改。

@desmonna
Copy link
Copy Markdown
Contributor Author

因为我的电脑上有几个不同的python版本,而运行GA安装依赖的也不是PATH中的python,所以遇到了这个问题

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.

fix:完善cli命令启动的subagent继承当前GA目录环境

2 participants