autogen icon indicating copy to clipboard operation
autogen copied to clipboard

ModuleNotFoundError: No module named 'openai.openai_object'

Open cowsking opened this issue 1 year ago • 5 comments

Traceback (most recent call last):
  File "/Users/hongyiwu/Instalily/code/auto-agent/action-agent/src/data_synthesizer.py", line 114, in <module>
    user_proxy.initiate_chat(manager, message="get the ads with worst purchase_roas for the ad set 600033 and pick 4 ads to that are the worst.")
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 544, in initiate_chat
    self.send(self.generate_init_message(**context), recipient, silent=silent)
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 344, in send
    recipient.receive(message, self, request_reply, silent)
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 475, in receive
    reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 887, in generate_reply
    final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 619, in generate_oai_reply
    response = client.create(
               ^^^^^^^^^^^^^^
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/autogen/oai/client.py", line 233, in create
    response = cache.get(key, None)
               ^^^^^^^^^^^^^^^^^^^^
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/diskcache/core.py", line 1173, in get
    value = self._disk.fetch(mode, filename, db_value, read)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hongyiwu/miniconda3/envs/agent/lib/python3.11/site-packages/diskcache/core.py", line 284, in fetch
    return pickle.load(io.BytesIO(value))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm using version 0.2.0b5 and encountered this issue. Do you have any solutions?

cowsking avatar Nov 15 '23 04:11 cowsking

@cowsking , are you trying to run one of the AutoGen code samples?

rickyloynd-microsoft avatar Nov 15 '23 05:11 rickyloynd-microsoft

@cowsking , are you trying to run one of the AutoGen code samples?

The samples were successful. The only model that did not work was gpt-3.5-turbo-16k.

cowsking avatar Nov 16 '23 02:11 cowsking

Could the problem be that you don't actually have access to gpt-3.5-turbo-16k? Or are you able to use that model from other code?

rickyloynd-microsoft avatar Nov 16 '23 02:11 rickyloynd-microsoft

Try to remove .cache folder. Worked for me

alifanov avatar Nov 24 '23 15:11 alifanov

removing .cache folder worked

monuminu avatar Jan 16 '24 12:01 monuminu

I have the same problem, deleting the.cache folder is invalid. Can you tell me what version of openai matches python3.10 and python3.11? After many unsuccessful attempts? I don't know what version of everyone can work properly?

20130216 avatar Jan 29 '24 13:01 20130216

I have the same problem, deleting the.cache folder is invalid. Can you tell me what version of openai matches python3.10 and python3.11? After many unsuccessful attempts? I don't know what version of everyone can work properly?

Hi @20130216 , have you tried installing the latest pyautogen and let pip find the proper openai package in a new environment?

thinkall avatar Jun 18 '24 05:06 thinkall

@thinkall I am trying to build a chatbot and I am getting the same module error. But the openai requirement is already satisfied. I am trying in VISUAL STUDIO CODE. Can you suggest me any other environment to work on?

Siva3601 avatar Jun 25 '24 04:06 Siva3601

@thinkall I am trying to build a chatbot and I am getting the same module error. But the openai requirement is already satisfied. I am trying in VISUAL STUDIO CODE. Can you suggest me any other environment to work on?

Hi @Siva3601 , I would suggest you try creating a new folder as your working directory and also a new virtual env for using the latest autogen. If you still see the same issue, please share more details on your env, and the code snippets for reproducing, so we can try to investigate the root cause. Thanks.

thinkall avatar Jul 07 '24 13:07 thinkall