Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
k2o333 opened this issue Oct 9, 2024 · 3 comments
Open

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

k2o333 opened this issue Oct 9, 2024 · 3 comments

Comments

@k2o333
Copy link

k2o333 commented Oct 9, 2024

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
Copy link

是找不到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
Copy link

手动构建出来的容器,使用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
Copy link
Author

k2o333 commented Oct 11, 2024

手动构建出来的容器,使用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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants