chatgpt-on-wechat
chatgpt-on-wechat copied to clipboard
timeout
前置确认
问题描述
timeout是什么原因呢,魔法已经用浏览器全局
终端日志 (如有报错)
[在此处粘贴终端日志]
Start auto replying. [INFO][2023-03-14 11:59:04][chat_gpt_bot.py:26] - [OPEN_AI] query=你好 [ERROR][2023-03-14 11:59:04][wechat_channel.py:163] - module 'openai.error' has no attribute 'Timeout' Traceback (most recent call last): File "C:\Users\Administrator\Desktop\chatgpt-on-wechat-master\bot\chatgpt\chat_gpt_bot.py", line 60, in reply_text response = openai.ChatCompletion.create( AttributeError: module 'openai' has no attribute 'ChatCompletion'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\Administrator\Desktop\chatgpt-on-wechat-master\channel\wechat\wechat_channel.py", line 159, in _do_send_text reply_text = super().build_reply_content(query, context) File "C:\Users\Administrator\Desktop\chatgpt-on-wechat-master\channel\channel.py", line 31, in build_reply_content return Bridge().fetch_reply_content(query, context) File "C:\Users\Administrator\Desktop\chatgpt-on-wechat-master\bridge\bridge.py", line 10, in fetch_reply_content return bot_factory.create_bot("chatGPT").reply(query, context) File "C:\Users\Administrator\Desktop\chatgpt-on-wechat-master\bot\chatgpt\chat_gpt_bot.py", line 42, in reply reply_content = self.reply_text(session, session_id, 0) File "C:\Users\Administrator\Desktop\chatgpt-on-wechat-master\bot\chatgpt\chat_gpt_bot.py", line 87, in reply_text except openai.error.Timeout as e: AttributeError: module 'openai.error' has no attribute 'Timeout'
环境
- 操作系统类型 (Mac/Windows/Linux):
- Python版本 ( 执行
python3 -V
): - pip版本 ( 依赖问题此项必填,执行
pip3 -V
):
已经添加了key"open_ai_api_key": "sk-2ENv00CxOhi4J7n8xxxxxxxxxxx",
1.openai需要更新到0.27.0 2.网络访问不通
(base) C:\Users\Administrator>pip show openai WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Name: openai Version: 0.8.0 Summary: Python client library for the OpenAI API Home-page: https://github.com/openai/openai-python Author: OpenAI Author-email: [email protected] License: UNKNOWN Location: c:\programdata\anaconda3\lib\site-packages Requires: tqdm, requests Required-by:
用了pip3 install --upgrade openai 默认更新到0.8.0可以吗,还是只能0.27.0
还是不行
@kuaitoukuai 更新到0.27.0了吗, pip3 show openai 看看
不行就先更新pip: pip3 install --upgrade pip
(base) C:\Users\Administrator>pip3 show openai WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Name: openai Version: 0.8.0 Summary: Python client library for the OpenAI API Home-page: https://github.com/openai/openai-python Author: OpenAI Author-email: [email protected] License: UNKNOWN Location: c:\programdata\anaconda3\lib\site-packages Requires: tqdm, requests Required-by:
(base) C:\Users\Administrator>pip3 show pip WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Name: pip Version: 23.0.1 Summary: The PyPA recommended tool for installing Python packages. Home-page: https://pip.pypa.io/ Author: The pip developers Author-email: [email protected] License: MIT Location: c:\programdata\anaconda3\lib\site-packages Requires: Required-by:
(base) C:\Users\Administrator>pip3 show itchat-uos WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Name: itchat-uos Version: 1.5.0.dev0 Summary: 复活Itchat, 仅仅需要 pip install itchat-uos, good luck ! Home-page: https://github.com/why2lyj/ItChat-UOS Author: Snow Wang Author-email: [email protected] License: MIT Location: c:\programdata\anaconda3\lib\site-packages Requires: pypng, pyqrcode, requests Required-by:
(base) C:\Users\Administrator>pip3 install --upgrade openai==0.27.0 WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple ERROR: Ignored the following versions that require a different python version: 0.11.0 Requires-Python >=3.7.1; 0.11.1 Requires-Python >=3.7.1; 0.11.2 Requires-Python >=3.7.1; 0.11.3 Requires-Python >=3.7.1; 0.11.4 Requires-Python >=3.7.1; 0.11.5 Requires-Python >=3.7.1; 0.11.6 Requires-Python >=3.7.1; 0.12.0 Requires-Python >=3.7.1; 0.13.0 Requires-Python >=3.7.1; 0.14.0 Requires-Python >=3.7.1; 0.15.0 Requires-Python >=3.7.1; 0.16.0 Requires-Python >=3.7.1; 0.18.0 Requires-Python >=3.7.1; 0.18.1 Requires-Python >=3.7.1; 0.19.0 Requires-Python >=3.7.1; 0.20.0 Requires-Python >=3.7.1; 0.22.0 Requires-Python >=3.7.1; 0.22.1 Requires-Python >=3.7.1; 0.23.0 Requires-Python >=3.7.1; 0.23.1 Requires-Python >=3.7.1; 0.24.0 Requires-Python >=3.7.1; 0.25.0 Requires-Python >=3.7.1; 0.26.0 Requires-Python >=3.7.1; 0.26.1 Requires-Python >=3.7.1; 0.26.2 Requires-Python >=3.7.1; 0.26.3 Requires-Python >=3.7.1; 0.26.4 Requires-Python >=3.7.1; 0.26.5 Requires-Python >=3.7.1; 0.27.0 Requires-Python >=3.7.1; 0.27.1 Requires-Python >=3.7.1; 0.27.2 Requires-Python >=3.7.1 ERROR: Could not find a version that satisfies the requirement openai==0.27.0 (from versions: 0.0.2, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.2.1, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.3.0, 0.4.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5) ERROR: No matching distribution found for openai==0.27.0
(base) C:\Users\Administrator>pip3 install -i http://mirrors.aliyun.com/pypi/simple/ openai==0.27.0 WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'. ERROR: Could not find a version that satisfies the requirement openai==0.27.0 (from versions: none) ERROR: No matching distribution found for openai==0.27.0
(base) C:\Users\Administrator>python --version Python 3.7.0
python 的pip安装如何取消指定网址下载
(base) C:\Users\Administrator>pip config list global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
如何取消永久从这个网址下载 您可以使用pip config unset global.index-url命令来取消永久从这个网址下载。这样,pip会恢复使用默认的索引服务器,即https://pypi.org/simple/。
(base) C:\Users\Administrator>pip config unset global.index-url ERROR: Fatal Internal error [id=1]. Please report as a bug. 为什么、如何解决
(base) C:\Users\Administrator>pip3 install -i https://pypi.org/simple/ openai==0.27.0 WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Looking in indexes: https://pypi.org/simple/ ERROR: Ignored the following versions that require a different python version: 0.11.0 Requires-Python >=3.7.1; 0.11.1 Requires-Python >=3.7.1; 0.11.2 Requires-Python >=3.7.1; 0.11.3 Requires-Python >=3.7.1; 0.11.4 Requires-Python >=3.7.1; 0.11.5 Requires-Python >=3.7.1; 0.11.6 Requires-Python >=3.7.1; 0.12.0 Requires-Python >=3.7.1; 0.13.0 Requires-Python >=3.7.1; 0.14.0 Requires-Python >=3.7.1; 0.15.0 Requires-Python >=3.7.1; 0.16.0 Requires-Python >=3.7.1; 0.18.0 Requires-Python >=3.7.1; 0.18.1 Requires-Python >=3.7.1; 0.19.0 Requires-Python >=3.7.1; 0.20.0 Requires-Python >=3.7.1; 0.22.0 Requires-Python >=3.7.1; 0.22.1 Requires-Python >=3.7.1; 0.23.0 Requires-Python >=3.7.1; 0.23.1 Requires-Python >=3.7.1; 0.24.0 Requires-Python >=3.7.1; 0.25.0 Requires-Python >=3.7.1; 0.26.0 Requires-Python >=3.7.1; 0.26.1 Requires-Python >=3.7.1; 0.26.2 Requires-Python >=3.7.1; 0.26.3 Requires-Python >=3.7.1; 0.26.4 Requires-Python >=3.7.1; 0.26.5 Requires-Python >=3.7.1; 0.27.0 Requires-Python >=3.7.1; 0.27.1 Requires-Python >=3.7.1; 0.27.2 Requires-Python >=3.7.1 ERROR: Could not find a version that satisfies the requirement openai==0.27.0 (from versions: 0.0.2, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.2.1, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.3.0, 0.4.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5) ERROR: No matching distribution found for openai==0.27.0
(base) C:\Users\Administrator>pip3 install -i https://pypi.org/simple/ --upgrade openai WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Looking in indexes: https://pypi.org/simple/ Requirement already satisfied: openai in c:\programdata\anaconda3\lib\site-packages (0.8.0) Collecting openai Downloading openai-0.10.5.tar.gz (157 kB) ---------------------------------------- 157.3/157.3 kB 35.5 kB/s eta 0:00:00 Preparing metadata (setup.py) ... done ERROR: No .egg-info directory found in C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-info-8318vqvg
下载了最新的openai-0.27.2.tar.gz库安装包,如何手动安装到python库中 https://pypi.org/project/openai/#files 您可以使用以下步骤来手动安装openai库:
将下载的openai-0.27.2.tar.gz文件解压到一个文件夹中,例如C:\openai 打开命令行窗口,切换到解压后的文件夹中,例如cd C:\openai 执行python setup.py install命令,等待安装完成 检查是否安装成功,执行python -c "import openai; print(openai.version)"命令,如果输出0.27.2,则表示安装成功
Using c:\users\administrator\appdata\roaming\python\python37\site-packages Searching for certifi==2022.9.24 Best match: certifi 2022.9.24 Adding certifi 2022.9.24 to easy-install.pth file
Using c:\programdata\anaconda3\lib\site-packages Searching for chardet==3.0.4 Best match: chardet 3.0.4 Adding chardet 3.0.4 to easy-install.pth file Installing chardetect-script.py script to C:\ProgramData\Anaconda3\Scripts Installing chardetect.exe script to C:\ProgramData\Anaconda3\Scripts
Using c:\users\administrator\appdata\roaming\python\python37\site-packages Finished processing dependencies for openai==0.27.2
(base) C:\Users\Administrator>pip show openai WARNING: Ignoring invalid distribution -illow (c:\users\administrator\appdata\roaming\python\python37\site-packages) Name: openai Version: 0.8.0 Summary: Python client library for the OpenAI API Home-page: https://github.com/openai/openai-python Author: OpenAI Author-email: [email protected] License: UNKNOWN Location: c:\programdata\anaconda3\lib\site-packages Requires: requests, tqdm Required-by:
还是不行呀
Requires: Python >=3.7.1 升级python
如果你已经安装了 Anaconda,你可以使用 conda 命令来升级 Python 版本。1
具体步骤如下:
打开 Anaconda Prompt,输入 conda update conda 来更新 conda 工具。
输入 conda update anaconda 来更新 Anaconda 发行版。
输入 conda update python 来更新 Python 版本。你可以指定你想要的版本,比如 conda install python=3.7.1。
打开 Anaconda Prompt,输入 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 命令,添加清华的镜像源。 输入 conda config --set show_channel_urls yes 命令,设置安装包时显示镜像来源。 输入 conda update python 命令,更新 python 的版本。
(base) C:\Users\Administrator>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
(base) C:\Users\Administrator> conda config --add channels usage: conda-script.py config [-h] [--json] [-v] [-q] [--system | --env | --file FILE] [--show [SHOW [SHOW ...]] | --show-sources | --validate | --describe [DESCRIBE [DESCRIBE ...]] | --write-default] [--get [KEY [KEY ...]] | --append KEY VALUE | --prepend KEY VALUE | --set KEY VALUE | --remove KEY VALUE | --remove-key KEY | --stdin] conda-script.py config: error: argument --prepend/--add: expected 2 arguments
(base) C:\Users\Administrator>conda config --set show_channel_urls yes
(base) C:\Users\Administrator>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ Warning: 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' already in 'channels' list, moving to the top
(base) C:\Users\Administrator>conda config --set show_channel_urls yes
(base) C:\Users\Administrator>conda update python Collecting package metadata (repodata.json): done Solving environment: /
defaults/win-64::_ipyw_jlab_nb_ext_conf==0.1.0=py37_0 运行conda update python到这一步就卡住了
这可能是因为你的环境中有一些包的版本不一致或者冲突,导致 conda 在解决环境时花费很长时间。12
你可以尝试以下方法来解决这个问题:
使用 conda update --all 命令来更新所有的包,然后再运行 conda update python 命令。 使用 conda install anaconda=custom 命令来恢复 anaconda 的默认版本,然后再运行 conda update python 命令。 使用 conda clean --all 命令来清除缓存和索引,然后再运行 conda update python 命令。 你可以参考这些网页12了解更多关于 conda 解决环境冲突的方法和原理。
已收到消息. 这可能是因为你的环境中有一些包的版本不一致或者冲突,导致 conda 在解决环境时花费很长时间。 你可以尝试以下方法来解决这个问题: - 使用 conda update --all
命令来更新所有的包,然后再运行 conda update python
命令。 - 使用 conda install anaconda=custom
命令来恢复 anaconda 的默认版本,然后再运行 conda update python
命令。 - 使用 conda clean --all
命令来清除缓存和索引,然后再运行 conda update python
命令。 你可以参考这些网页 了解更多关于 conda 解决环境冲突的方法和原理。
了解详细信息:
1. github.com
2. github.com
3. anaconda.org
conda clean --all 电脑C盘终于不拥挤了。。
把python全部卸载重新安装。。
等了很久很久
Successfully installed itchat-uos-1.5.0.dev0 pypng-0.20220715.0 pyqrcode-1.2.1
Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 frozenlist-1.3.3 multidict-6.0.4 openai-0.27.2 yarl-1.8.2
修改time.sleep(15)得咯
@kuaitoukuai 我看最新一次已经正常了, 报的错是openai后台过载了, 现在应该恢复了吧?