MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Unable to use MetaGPT

Open sghanta97 opened this issue 1 year ago • 3 comments

sghanta@sghanta--MacBookPro16 metagpt % python3 startup.py "Create an app" 2023-10-25 23:50:20.302 | INFO | metagpt.config:init:44 - Config loading done. 2023-10-25 23:50:23.428 | INFO | metagpt.software_company:invest:39 - Investment: $3.0. 2023-10-25 23:50:23.429 | INFO | metagpt.roles.role:_act:167 - Alice(Product Manager): ready to WritePRD 2023-10-25 23:50:23.701 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 0.246(s), this was the 1st time calling it. 2023-10-25 23:50:24.792 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 1.337(s), this was the 2nd time calling it. 2023-10-25 23:50:25.883 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 2.428(s), this was the 3rd time calling it. 2023-10-25 23:50:25.883 | ERROR | metagpt.provider.openai_api:log_and_reraise:130 - Retry attempts exhausted. Last exception: Error communicating with OpenAI 2023-10-25 23:50:25.884 | WARNING | metagpt.provider.openai_api:log_and_reraise:131 - Recommend going to https://deepwisdom.feishu.cn/wiki/MsGnwQBjiif9c3koSJNcYaoSnu4#part-XdatdVlhEojeAfxaaEZcMV3ZniQ See FAQ 5.8

2023-10-25 23:50:26.978 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 0.094(s), this was the 1st time calling it. 2023-10-25 23:50:28.075 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 1.191(s), this was the 2nd time calling it. 2023-10-25 23:50:29.169 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 2.285(s), this was the 3rd time calling it. 2023-10-25 23:50:29.169 | ERROR | metagpt.provider.openai_api:log_and_reraise:130 - Retry attempts exhausted. Last exception: Error communicating with OpenAI 2023-10-25 23:50:29.169 | WARNING | metagpt.provider.openai_api:log_and_reraise:131 - Recommend going to https://deepwisdom.feishu.cn/wiki/MsGnwQBjiif9c3koSJNcYaoSnu4#part-XdatdVlhEojeAfxaaEZcMV3ZniQ See FAQ 5.8

2023-10-25 23:50:30.254 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 0.084(s), this was the 1st time calling it. 2023-10-25 23:50:31.350 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 1.180(s), this was the 2nd time calling it. 2023-10-25 23:50:32.456 | WARNING | tenacity.after:log_it:44 - Finished call to 'metagpt.provider.openai_api.OpenAIGPTAPI.acompletion_text' after 2.286(s), this was the 3rd time calling it. 2023-10-25 23:50:32.457 | ERROR | metagpt.provider.openai_api:log_and_reraise:130 - Retry attempts exhausted. Last exception: Error communicating with OpenAI 2023-10-25 23:50:32.457 | WARNING | metagpt.provider.openai_api:log_and_reraise:131 - Recommend going to https://deepwisdom.feishu.cn/wiki/MsGnwQBjiif9c3koSJNcYaoSnu4#part-XdatdVlhEojeAfxaaEZcMV3ZniQ See FAQ 5.8

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport await waiter File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/sslproto.py", line 574, in _on_handshake_complete raise handshake_exc File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/sslproto.py", line 556, in _do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 979, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 678, in arequest_raw result = await session.request(**request_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection raise last_exc File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 982, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/actions/action.py", line 65, in _aask_v1 content = await self.llm.aask(prompt, system_msgs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/provider/base_gpt_api.py", line 44, in aask rsp = await self.acompletion_text(message, stream=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/init.py", line 322, in iter return self.retry_error_callback(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/provider/openai_api.py", line 137, in log_and_reraise raise retry_state.outcome.exception() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/provider/openai_api.py", line 238, in acompletion_text return await self._achat_completion_stream(messages) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/provider/openai_api.py", line 163, in _achat_completion_stream response = await openai.ChatCompletion.acreate(**self._cons_kwargs(messages), stream=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 45, in acreate return await super().acreate(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 219, in acreate response, _, api_key = await requestor.arequest( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 374, in arequest result = await self.arequest_raw( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 695, in arequest_raw raise error.APIConnectionError("Error communicating with OpenAI") from e openai.error.APIConnectionError: Error communicating with OpenAI

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/sghanta/Desktop/meta_gpt/metagpt/startup.py", line 72, in fire.Fire(main) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fire/core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fire/core.py", line 466, in _Fire component, remaining_args = _CallAndUpdateTrace( ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/startup.py", line 68, in main asyncio.run(startup(idea, investment, n_round, code_review, run_tests, implement)) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/startup.py", line 47, in startup await company.run(n_round=n_round) File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/software_company.py", line 60, in run await self.environment.run() File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/environment.py", line 67, in run await asyncio.gather(*futures) File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/roles/role.py", line 240, in run rsp = await self._react() ^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/roles/role.py", line 209, in _react return await self._act() ^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/roles/role.py", line 168, in _act response = await self._rc.todo.run(self._rc.important_memory) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sghanta/Desktop/meta_gpt/metagpt/metagpt/actions/write_prd.py", line 240, in run prd = await self._aask_v1(prompt, "prd", OUTPUT_MAPPING, format=format) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x128ee2190 state=finished raised APIConnectionError>] sghanta@sghanta--MacBookPro16 metagpt %

sghanta97 avatar Oct 26 '23 06:10 sghanta97

I see this is recommended approach "Have you try to run Install Certificates.command file in Python 3.x folder?"

but can't seem to figure out how to do this.

sghanta97 avatar Oct 26 '23 06:10 sghanta97

Seems to be a problem during the ssl certificate check. Can you try to run this command openssl s_client -connect api.openai.com:443 to see if you mac is able to connect to openai? If it's not, you can try to update the ssl certificates running brew update & brew upgrade openssl

antunsz avatar Oct 27 '23 14:10 antunsz

Thanks @antunsz , hmm looks like this is failing I did this: brew update & brew upgrade openssl , but still encounter the same issue.

sghanta@sghanta--MacBookPro16 metagpt % openssl s_client -connect api.openai.com:443 CONNECTED(00000006) 4598941356:error:14004410:SSL routines:CONNECT_CR_SRVR_HELLO:sslv3 alert handshake failure:/AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/libressl/libressl-2.8/ssl/ssl_pkt.c:1200:SSL alert number 40 4598941356:error:140040E5:SSL routines:CONNECT_CR_SRVR_HELLO:ssl handshake failure:/AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/libressl/libressl-2.8/ssl/ssl_pkt.c:585:

no peer certificate available

No client certificate CA names sent

SSL handshake has read 7 bytes and written 0 bytes

New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : 0000 Session-ID: Session-ID-ctx: Master-Key: Start Time: 1698522337 Timeout : 7200 (sec) Verify return code: 0 (ok)

sghanta97 avatar Oct 28 '23 19:10 sghanta97