Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: Cannot import name 'register_function' from 'autogen' in workflow.py #8

Closed
sm18lr88 opened this issue May 24, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sm18lr88
Copy link

Description:
I encountered an ImportError when running the agent_annual_report.ipynb notebook. The error occurs in the workflow.py file while attempting to import register_function from the autogen package.

Error Message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[2], [line 5](vscode-notebook-cell:?execution_count=2&line=5)
      [3](vscode-notebook-cell:?execution_count=2&line=3) from textwrap import dedent
      [4](vscode-notebook-cell:?execution_count=2&line=4) from finrobot.utils import register_keys_from_json
----> [5](vscode-notebook-cell:?execution_count=2&line=5) from finrobot.agents.workflow import SingleAssistantShadow

File e:\documents\projects\apps\financial\finrobot\finrobot\agents\workflow.py:6
      [3](file:///E:/documents/projects/apps/financial/finrobot/finrobot/agents/workflow.py:3) import autogen
      [4](file:///E:/documents/projects/apps/financial/finrobot/finrobot/agents/workflow.py:4) from autogen.cache import Cache
----> [6](file:///E:/documents/projects/apps/financial/finrobot/finrobot/agents/workflow.py:6) from ..toolkits import register_toolkits
      [7](file:///E:/documents/projects/apps/financial/finrobot/finrobot/agents/workflow.py:7) from .utils import *
     [10](file:///E:/documents/projects/apps/financial/finrobot/finrobot/agents/workflow.py:10) class FinRobot(autogen.AssistantAgent):

File e:\documents\projects\apps\financial\finrobot\finrobot\toolkits.py:1
----> [1](file:///E:/documents/projects/apps/financial/finrobot/finrobot/toolkits.py:1) from autogen import register_function, ConversableAgent
      [2](file:///E:/documents/projects/apps/financial/finrobot/finrobot/toolkits.py:2) from .data_source import *
      [3](file:///E:/documents/projects/apps/financial/finrobot/finrobot/toolkits.py:3) from .functional.coding import CodingUtils

ImportError: cannot import name 'register_function' from 'autogen' (c:\Users\Admin\miniconda3\envs\finrobot\lib\site-packages\autogen\__init__.py)

Steps to Reproduce:

  1. Clone the repository.
  2. Follow the installation steps and configure API keys.
  3. Open agent_annual_report.ipynb notebook.
  4. Run the initial cell to import necessary packages and functions.

Environment:

  • OS: Windows 11
  • Python version: 3.10
  • Miniconda environment: finrobot

Expected Behavior:
Successful import of register_function from the autogen package without any errors.

Actual Behavior:
The import statement fails, raising an ImportError.

Relevant Code:

from ..toolkits import register_toolkits

Thanks

@BruceYanghy BruceYanghy added the bug Something isn't working label May 25, 2024
@Noir97
Copy link
Member

Noir97 commented May 25, 2024

Make sure you have pyautogen installed. pip list | grep autogen and verify your installation.

If it's properly installed, can you provide the version of pyautogen you're using

@BruceYanghy BruceYanghy self-assigned this May 25, 2024
@sm18lr88
Copy link
Author

Thanks. I recreated the conda environment, reinstalled all the requirements, and it then worked.

Something mist have happened to my original environment.

Sorry for my error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants