geekan / MetaGPT

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
https://deepwisdom.ai/
MIT License
43.51k stars 5.18k forks source link

cannot import name 'Message' from 'anthropic.types #1261

Open huangpan2507 opened 4 months ago

huangpan2507 commented 4 months ago

Bug description

Environment information

Screenshots or logs `C:\Users\huangpan\PycharmProjects\MetaGPT.venv\Scripts\python.exe C:\Users\huangpan\PycharmProjects\MetaGPT\examples\hello_world.py 2024-05-10 21:46:48.500 | INFO | metagpt.const:get_metagpt_package_root:29 - Package root set to C:\Users\huangpan\PycharmProjects\MetaGPT Traceback (most recent call last): File "C:\Users\huangpan\PycharmProjects\MetaGPT\examples\hello_world.py", line 10, in from metagpt.llm import LLM File "C:\Users\huangpan\PycharmProjects\MetaGPT\metagpt\llm.py", line 11, in from metagpt.context import Context File "C:\Users\huangpan\PycharmProjects\MetaGPT\metagpt\context.py", line 16, in from metagpt.provider.base_llm import BaseLLM File "C:\Users\huangpan\PycharmProjects\MetaGPT\metagpt\provider__init.py", line 19, in from metagpt.provider.anthropic_api import AnthropicLLM File "C:\Users\huangpan\PycharmProjects\MetaGPT\metagpt\provider\anthropic_api.py", line 5, in from anthropic.types import Message, Usage ImportError: cannot import name 'Message' from 'anthropic.types' (C:\Users\huangpan\PycharmProjects\MetaGPT.venv\lib\site-packages\anthropic\types\init__.py)

Process finished with exit code 1 `

also, even I use openai with gpt-4-turbo, downgrade/upgrade the version of metagpt, same problem had occur.......

garylin2099 commented 3 months ago

Seems like an issue with Anthropic package, can @better629 check about it?

better629 commented 3 months ago

from the log, it seems that you have the conda env for_meta, but the error message show that you are not in this env (MetaGPT.venv\lib\site-packages\anthropic\types). So, can you check your cmd firstly?

I have checked the anthropic==0.18.1, it does exist. image

huangpan2507 commented 1 month ago

from the log, it seems that you have the conda env for_meta, but the error message show that you are not in this env (MetaGPT.venv\lib\site-packages\anthropic\types). So, can you check your cmd firstly?

I have checked the anthropic==0.18.1, it does exist. image

I've been so busy with other stuff lately that I'd forgotten about this... anyway, thanks for the help...