InternLM / MindSearch

🔍 An LLM-based Multi-agent Framework of Web Search Engine (like Perplexity.ai Pro and SearchGPT)
https://mindsearch.netlify.app/
Apache License 2.0
5.04k stars 509 forks source link

安装完以后运行msdl各种报错 #215

Open k2o333 opened 3 weeks ago

k2o333 commented 3 weeks ago

Traceback (most recent call last): File "/root/anaconda3/lib/python3.12/site-packages/dotenv/main.py", line 130, in rewrite with open(path, "w+", encoding=encoding) as source: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/anaconda3/bin/msdl", line 33, in sys.exit(load_entry_point('msdl', 'console_scripts', 'msdl')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/MindSearch/docker/msdl/main.py", line 159, in main setup_i18n() File "/root/MindSearch/docker/msdl/i18n.py", line 35, in setup_i18n set_env_variable("LAUNCHER_INTERACTION_LANGUAGE", system_language) File "/root/MindSearch/docker/msdl/i18n.py", line 17, in set_env_variable set_key(dotenv_file, var_name, value) File "/root/anaconda3/lib/python3.12/site-packages/dotenv/main.py", line 174, in set_key with rewrite(dotenv_path, encoding=encoding) as (source, dest): File "/root/anaconda3/lib/python3.12/contextlib.py", line 137, in enter return next(self.gen) ^^^^^^^^^^^^^^ File "/root/anaconda3/lib/python3.12/site-packages/dotenv/main.py", line 136, in rewrite if os.path.isfile(dest.name): ^^^^ UnboundLocalError: cannot access local variable 'dest' where it is not associated with a value

KelvinJiang commented 3 weeks ago

是找不到env文件,这个函数这里把报错设置为True,可以看到在找env文件时出现错误。 def find_dotenv( filename: str = '.env', raise_error_if_not_found: bool = True, usecwd: bool = False, ) -> str:

手动创建MindSearch/docker/msdl/temp/.env文件,可以解决这个问题。 这个文件解决后,后面还会遇到/home/ai/code/MindSearch/docker/msdl/temp/docker-compose.yaml文件不正确的问题,提示'/home/ai/code/MindSearch/docker/msdl/temp/docker-compose.yaml', service 'name' must be a mapping not a string. 原因在于根据用户选择生成的yaml格式有问题,第一行多了name: mindsearch,删除即可。 完了还有问题,yaml文件中的格式对齐问题,还有个语法不识别。最后我手动修改成了如下:

version: '3'
services:
  backend:
    build:
      context: /home/ai/code/MindSearch/.
      dockerfile: /home/ai/code/MindSearch/docker/msdl/temp/backend.dockerfile
    command: python -m mindsearch.app --lang cn --model_format internlm_silicon
    container_name: mindsearch-backend
    env_file:
      - .env
    environment:
      - PYTHONUNBUFFERED=1
      - OPENAI_API_BASE=https://api.openai.com/v1
    image: mindsearch/backend:latest
    ports:
      - 8002:8002
    restart: unless-stopped
  frontend:
    build:
      context: /home/ai/code/MindSearch/.
      dockerfile: /home/ai/code/MindSearch/docker/msdl/temp/frontend.dockerfile
    container_name: mindsearch-frontend
    depends_on:
      - backend
    image: mindsearch/frontend:latest
    ports:
      - 8080:8080
    restart: unless-stopped

还有个配置文件/home/ai/code/MindSearch/docker/msdl/translations/zh_CN.yaml中的语言名称,zh_CN与程序中需要的不匹配,手动修改成了zh,可以通过了。

之后再手动调用构建,可以正常开始跑了。

docker-compose -f /home/ai/code/MindSearch/docker/msdl/temp/docker-compose.yaml --env-file /home/ai/code/MindSearch/docker/msdl/temp/.env up -d --build
KelvinJiang commented 3 weeks ago

手动构建出来的容器,使用docker-compose -f /home/ai/code/MindSearch/docker/msdl/temp/docker-compose.yaml --env-file /home/ai/code/MindSearch/docker/msdl/temp/.env up -d启动后,backend一直在重启,不知道什么原因。

k2o333 commented 3 weeks ago

手动构建出来的容器,使用docker-compose -f /home/ai/code/MindSearch/docker/msdl/temp/docker-compose.yaml --env-file /home/ai/code/MindSearch/docker/msdl/temp/.env up -d启动后,backend一直在重启,不知道什么原因。

哇,谢谢兄弟。你yaml文件里,为何要放openai的url,不是用silicon cloud吗

我看到是找不到env文件,之前改了项目根目录的env文件,哈哈 我比较小白。其他人tmp文件夹自动有.env吗? zh-cn的问题之前那个版本就挺困扰我的。

backend我之前版本是根本找不到,一直重启是不是因为默认是要调用gpu?