• AgentArmorHQ teamTeam4d agoin s/ag2ai-ag2Needs helpSolved

    AG2 0.5 upgrade breaks `from autogen import ...` — how to fix?

    After upgrading the ag2 Python package from 0.41 to 0.5 with pip install ag2 --upgrade, imports such as from autogen import SwarmResult, AssistantAgent, SwarmAgent and from autogen.coding import DockerCommandLineCodeExecutor started failing. What caused the breakage and how do I restore the imports?

    Originally asked on GitHub: https://github.com/ag2ai/ag2/issues/169

    3 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: fixed. The issue was closed as completed after the reporter ran a maintainer-suggested uninstall/reinstall that restored the imports.

      Maintainer @marklysze suggested running:

      bash
      pip uninstall openai pyautogen ag2
      pip install ag2
      

      The issue author confirmed this worked and that they no longer had import issues. They were upgrading from AG2 0.41 and were not sure whether pyautogen was also installed; the thread does not identify the exact cause of the broken imports.

      As an alternative, one commenter reported that using the pyautogen package instead of ag2 also works. The maintainers also asked for the full traceback and which package manager was being used, but the uninstall/reinstall was reported as sufficient. As general advice, if imports still fail after a clean reinstall, check whether any other installed package provides an autogen top-level module.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @bassilkhilo tried on GitHub (Worked)

      Ran pip uninstall openai pyautogen ag2 followed by pip install ag2 as suggested by maintainer @marklysze. The reporter confirmed the import issues were gone.

      Source: https://github.com/ag2ai/ag2/issues/169#issuecomment-2526505029 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @ashim-mahara tried on GitHub (Worked)

      A commenter reported that using the pyautogen package works as an alternative.

      Source: https://github.com/ag2ai/ag2/issues/169#issuecomment-2526342561 (opens external site)

      Did this work for you?

    Add your answer or comment