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

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

Open
huangpan2507 opened this issue May 10, 2024 · 2 comments
Open

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

huangpan2507 opened this issue May 10, 2024 · 2 comments

Comments

@huangpan2507
Copy link

huangpan2507 commented May 10, 2024

Bug description

Environment information

  • LLM type and model name: zhipuai glm-4
  • System version: windows 11 and use conda
  • Python version: 3.11.0
  • MetaGPT version or branch: 0.8.1
  • packages version:
    (for_meta) C:\Users\huangpan\PycharmProjects\MetaGPT>pip list
    Package Version Editable project location

aiofiles 23.2.1
aiohttp 3.8.6
aiolimiter 1.1.0
aioredis 2.0.1
aiosignal 1.3.1
annotated-types 0.6.0
anthropic 0.18.1
anyio 4.3.0
anytree 2.12.1
asgiref 3.8.1
asttokens 2.4.1
async-timeout 4.0.3
attrs 23.2.0
bce-python-sdk 0.9.7
beautifulsoup4 4.12.3
cachetools 5.3.3
camel-converter 3.1.2
certifi 2024.2.2
channels 4.0.0
chardet 5.2.0
charset-normalizer 3.3.2
click 8.1.7
cloudpickle 3.0.0
colorama 0.4.6
comm 0.2.2
dashscope 1.14.1
debugpy 1.8.1
decorator 5.1.1
deprecation 2.1.0
dill 0.3.8
distro 1.9.0
Django 5.0.6
dnspython 2.6.1
et-xmlfile 1.1.0
executing 2.0.1
faiss-cpu 1.7.4
Farama-Notifications 0.0.4
fastjsonschema 2.19.1
filelock 3.14.0
fire 0.4.0
frozenlist 1.4.1
fsspec 2024.3.1
future 1.0.0
gitdb 4.0.11
gitignore_parser 0.1.9
GitPython 3.1.40
google-ai-generativelanguage 0.4.0
google-api-core 2.19.0
google-auth 2.29.0
google-generativeai 0.4.1
googleapis-common-protos 1.63.0
greenlet 3.0.3
grpcio 1.63.0
grpcio-status 1.62.2
grpcio-tools 1.62.2
gymnasium 0.29.1
h11 0.14.0
h2 4.1.0
hpack 4.0.0
httpcore 1.0.5
httpx 0.27.0
huggingface-hub 0.23.0
hyperframe 6.0.1
idna 3.7
imap-tools 1.5.0
ipykernel 6.27.1
ipython 8.17.2
ipywidgets 8.1.1
isodate 0.6.1
jedi 0.19.1
joblib 1.4.2
jsonschema 4.22.0
jsonschema-path 0.3.2
jsonschema-spec 0.2.4
jsonschema-specifications 2023.7.1
jupyter_client 8.6.1
jupyter_core 5.7.2
jupyterlab_widgets 3.0.10
lancedb 0.4.0
lazy-object-proxy 1.10.0
libcst 1.0.1
loguru 0.6.0
lxml 5.2.1
markdown-it-py 3.0.0
MarkupSafe 2.1.5
matplotlib-inline 0.1.7
mdurl 0.1.2
meilisearch 0.21.0
metagpt 0.8.1 C:\Users\huangpan\PycharmProjects\MetaGPT
more-itertools 10.2.0
motor 3.4.0
multidict 6.0.5
multiprocess 0.70.16
mypy-extensions 1.0.0
nbclient 0.9.0
nbformat 5.9.2
nest-asyncio 1.6.0
networkx 3.2.1
numpy 1.26.4
openai 1.28.0
openapi-core 0.18.2
openapi-schema-validator 0.6.2
openapi-spec-validator 0.7.1
openpyxl 3.1.2
overrides 7.7.0
packaging 24.0
pandas 2.1.1
parse 1.20.1
parso 0.8.4
pathable 0.4.3
pillow 10.3.0
pip 24.0
platformdirs 4.2.1
playwright 1.43.0
portalocker 2.8.2
prance 23.6.21.0
prompt-toolkit 3.0.43
proto-plus 1.23.0
protobuf 4.25.3
psutil 5.9.8
pure-eval 0.2.2
py 1.11.0
pyarrow 16.0.0
pyasn1 0.6.0
pyasn1_modules 0.4.0
pycryptodome 3.20.0
pydantic 2.7.1
pydantic_core 2.18.2
pyee 11.1.0
Pygments 2.18.0
PyJWT 2.8.0
pylance 0.9.0
pymongo 4.7.2
python-dateutil 2.9.0.post0
python-docx 0.8.11
python-dotenv 1.0.0
pytz 2024.1
pywin32 306
PyYAML 6.0.1
pyzmq 26.0.3
qdrant-client 1.7.0
qianfan 0.3.2
rank-bm25 0.2.2
ratelimiter 1.2.0.post0
referencing 0.30.2
regex 2023.12.25
requests 2.31.0
retry 0.9.2
rfc3339-validator 0.1.4
rich 13.6.0
rpds-py 0.18.1
rsa 4.9
ruamel.yaml 0.18.6
ruamel.yaml.clib 0.2.8
scikit-learn 1.3.2
scipy 1.13.0
semantic-kernel 0.4.3.dev0
semver 3.0.2
setuptools 65.6.3
six 1.16.0
smmap 5.0.1
sniffio 1.3.1
socksio 1.0.0
soupsieve 2.5
sqlparse 0.5.0
stack-data 0.6.3
ta 0.10.2
tenacity 8.2.3
termcolor 2.4.0
threadpoolctl 3.5.0
tiktoken 0.6.0
tokenizers 0.19.1
tornado 6.4
tqdm 4.66.2
traitlets 5.14.3
typer 0.9.0
typing_extensions 4.9.0
typing-inspect 0.8.0
tzdata 2024.1
urllib3 1.26.18
wcwidth 0.2.13
websocket-client 1.6.2
websockets 11.0.3
Werkzeug 3.0.3
wheel 0.43.0
widgetsnbextension 4.0.10
win32-setctime 1.1.0
wrapt 1.15.0
yarl 1.9.4
zhipuai 2.0.1

  • installation method: pip install -e .

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
Copy link
Collaborator

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

@better629
Copy link
Collaborator

better629 commented May 16, 2024

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

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

No branches or pull requests

3 participants