Skip to content

fix(pack): restore conda packaging tools before conda-pack (#3988)#4093

Merged
xieyxclack merged 1 commit into
agentscope-ai:mainfrom
jinglinpeng:codex-3988-windows-conda-pack-pip
May 8, 2026
Merged

fix(pack): restore conda packaging tools before conda-pack (#3988)#4093
xieyxclack merged 1 commit into
agentscope-ai:mainfrom
jinglinpeng:codex-3988-windows-conda-pack-pip

Conversation

@jinglinpeng
Copy link
Copy Markdown
Collaborator

@jinglinpeng jinglinpeng commented May 7, 2026

Description

This PR fixes Windows desktop packaging failures where conda-pack reports conda-managed setuptools files as deleted or overwritten after installing qwenpaw[full] into the temporary packaging environment.

The root cause is that pip dependency resolution can uninstall/reinstall packages that were originally managed by conda. The packaging script now avoids explicitly upgrading pip with pip, then restores conda-managed pip, setuptools, and wheel before running conda-pack. The existing unpinned conda-pack install behavior is preserved.

Related Issue: Fixes #3988

Security Considerations: No security-sensitive runtime behavior changes. This only affects the temporary conda environment used by desktop packaging scripts.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

For Channel Changes (DingTalk, Feishu, QQ, Console, etc.)

  • I ran ./scripts/check-channels.sh (or ./scripts/check-channels.sh --changed) and it passes
  • Contract test exists in tests/contract/channels/test_<channel>_contract.py (REQUIRED)
  • Contract test implements create_instance() with proper channel initialization
  • All 19 contract verification points pass (see tests/contract/channels/__init__.py)
  • Optional: Unit tests in tests/unit/channels/test_<channel>.py for complex internal logic

Testing

  • Ran Python syntax validation for the changed packaging script.
  • Ran full A/B Windows packaging reproductions from clean temporary repository copies:
    • Original script reproduced the reported CondaPackError for overwritten setuptools files during conda-pack.
    • Patched script passed the conda-pack phase and produced dist\qwenpaw-env.zip.
  • The patched full run then stopped later in the Codex sandbox because PowerShell ConstrainedLanguage blocks [System.IO.Path]::IsPathRooted(...); this happens after the fixed conda-pack step and is unrelated to this issue.

Local Verification Evidence

python -m py_compile scripts\pack\build_common.py
# passed

scripts/pack/build_win.ps1  # A/B full packaging runs from clean temporary copies
# original: CondaPackError: Files managed by conda were found to have been deleted/overwritten - setuptools 82.0.1
# patched: Packed to ...\dist\qwenpaw-env.zip

Additional Notes

The fix intentionally does not pin or change the conda-pack version. The packaging script keeps installing conda-pack using the existing unversioned conda spec.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Welcome to QwenPaw! 🐾

Hi @jinglinpeng, this is your 12th Pull Request.

📋 About PR Template

To help maintainers review your PR faster, please make sure to include:

  • Description - What this PR does and why
  • Type of Change - Bug fix / Feature / Breaking change / Documentation / Refactoring
  • Component(s) Affected - Core / Console / Channels / Skills / CLI / Documentation / Tests / CI/CD / Scripts
  • Checklist:
    • Run and pass pre-commit run --all-files
    • Run and pass relevant tests (pytest or as applicable)
    • Update documentation if needed
  • Testing - How to test these changes
  • Local Verification Evidence:
    pre-commit run --all-files
    # paste summary result
    
    pytest
    # paste summary result

Complete PR information helps speed up the review process. You can edit the PR description to add these details.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.

@jinglinpeng jinglinpeng changed the title Fix Windows packaging conda-pack after pip installs fix(pack): restore conda packaging tools before conda-pack (#3988) May 7, 2026
@jinglinpeng jinglinpeng marked this pull request as ready for review May 7, 2026 11:18
@xieyxclack xieyxclack merged commit 67ff5aa into agentscope-ai:main May 8, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in QwenPaw May 8, 2026
@wfeng007
Copy link
Copy Markdown

wfeng007 commented May 8, 2026

有些建议。可能不只是 pip, setuptools 。如果是conda-pack 0.8.1,还有个库:packaging
所以需要指定conda-pack版本。我本地处理方案是,执行后重新装备一遍会检测的包:

        # Restore conda-managed pip, setuptools, and packaging to fix conda-pack conflicts
        # This overwrites any pip-modified files back to conda versions
        # Prevents "Files managed by conda were found to have been deleted/overwritten" error
        print("Restoring conda-managed pip, setuptools, and packaging...")
        _run(
            [
                conda,
                "run",
                "-n",
                env_name,
                "conda",
                "install",
                "pip",
                "setuptools",
                "packaging",
                "--force-reinstall",
                "-y",
                "--quiet",
            ],
        )

另外,def _run( cmd: list[str], cwd: Path | None = None, env: dict[str, str] | None = None, ) -> None:
这个方法如果ci环境兼容,最好重写成子进程std/sterr反馈到主进程打印标准输出。否则及其难排障。
我本地跑通的改动:
build_common.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: 打包windows版本 conda-pack <=0.7.1 会与 pip install qwenpaw[full] 动作冲突

4 participants