chatgpt-on-wechat icon indicating copy to clipboard operation
chatgpt-on-wechat copied to clipboard

云服务器部署时报错No module named 'itchat'

Open MicroOpeMaster opened this issue 1 year ago • 2 comments

前置确认

  1. 网络能够访问openai接口
  2. python 已安装:版本在 3.7 ~ 3.10 之间,依赖已安装
  3. 在已有 issue 中未搜索到类似问题
  4. FAQS 中无类似问题

问题描述

简要说明、截图、复现步骤等,也可以是需求或想法 运行: touch nohup.out nohup python3 app.py & tail -f nohup.out 报错:No module named 'itchat'

终端日志 (如有报错)

[INFO][2023-03-22 22:12:06][config.py:19] - [INIT] load config: {'model': 'gpt-3.5-turbo', 'proxy': '127.0.0.1:7890', 'single_chat_prefix': ['bot', '@bot'], 'single_chat_reply_prefix': '[bot] ', 'group_chat_prefix': ['@bot'], 'group_name_white_list': ['ChatGPT测试群', 'ChatGPT测试群2'], 'image_create_prefix': ['画', '看', '找'], 'speech_recognition': False, 'voice_reply_voice': False, 'conversation_max_tokens': 1000, 'expires_in_seconds': 3600, 'character_desc': '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。'}
[ERROR][2023-03-22 22:12:06][app.py:19] - App startup failed!
[ERROR][2023-03-22 22:12:06][app.py:20] - No module named 'itchat'
Traceback (most recent call last):
  File "app.py", line 14, in <module>
    channel = channel_factory.create_channel("wx")
  File "/home/lighthouse/chatgpt-on-wechat/channel/channel_factory.py", line 12, in create_channel
    from channel.wechat.wechat_channel import WechatChannel
  File "/home/lighthouse/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 7, in <module>
    import itchat
ModuleNotFoundError: No module named 'itchat'
[lighthouse@VM-0-12-centos chatgpt-on-wechat]$ 

环境

  • 操作系统类型 (Linux):
  • Python版本 ( 执行 python3.8.2 ):
  • pip版本 ( 依赖问题此项必填,执行 pip 21.3.1):

MicroOpeMaster avatar Mar 22 '23 14:03 MicroOpeMaster

同样的问题 同样的报错。。。。

anqi666 avatar Mar 22 '23 14:03 anqi666

兄弟,你差一个模块,itchat啊,requirement.txt 安装一下

cd 到你的源代码目录,确定requirement.txt在这里
pip3 install -r requirement.txt

如果你用的虚拟环境,那你应该知道怎么给虚拟环境安装第三方模块吧! 0.0

a5225662 avatar Mar 22 '23 15:03 a5225662

我也遇到了同样的问题在创建了一个conda新环境里用pip3安装,但是我检查了conda list,没有这些库,后来使用PATH OF CONDA ENV/bin/pip进行安装后成功,在ubuntu22.04上成功

Tyler913 avatar Mar 24 '23 03:03 Tyler913

1、conda的环境需要activate
2、云服务器有的时候用的是venv管理python的,那个你得在文件夹目录下找到虚拟环境里面的python/pip来使用,一般是app_name/95910073f9c64328ccf07ac012fd3888_venv/bin/python3 app.py 来执行 同样你安装也需要用app_name/95910073f9c64328ccf07ac012fd3888_venv/bin/pip3 install <module_name>

a5225662 avatar Mar 24 '23 03:03 a5225662

似乎是缺少pip的某个模块(?)更新了服务器的系统后重新配置成功了,十分感谢

MicroOpeMaster avatar Mar 24 '23 04:03 MicroOpeMaster