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

本地部署agent时,报错Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python #310

Open
lllLllori opened this issue Feb 25, 2024 · 6 comments
Assignees
Labels
envrionment any issues with envrionment setting problem

Comments

@lllLllori
Copy link

使用的是anaconda的虚拟环境,pythonpath环境变量也添加了modelscopeagent的路径
QQ截图20240225162303

@mushenL
Copy link
Collaborator

mushenL commented Feb 26, 2024

您好,本地部署可以参考这个文档
https://github.com/modelscope/modelscope-agent/blob/master/docs/local_deploy.md
请问您具体是在那个环节报的错,方便提供一下相应的参数我们这边复现一下为您定位?

@lllLllori
Copy link
Author

@lllLllori
Copy link
Author

这是我的报错信息,我删除了部分INFO
2024-02-26 16:20:28,836 - modelscope - INFO - PyTorch version 2.2.1 Found.
2024-02-26 16:20:28,840 - modelscope - INFO - Loading ast index from C:\Users\lenovo.cache\modelscope\ast_indexer
2024-02-26 16:20:29,044 - modelscope - INFO - Loading done! Current index file version is 1.12.0, with md5 9db3b0eca2da1eb205e4bf56bc262664 and a total number of 964 components indexed
Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().
2024-02-26 16:20:31.263 - modelscope-agent - INFO - | message: builder_cfg | uuid: local_user | details: {'builder_cfg': "Config (path: /tmp/agentfabric\config\builder_config.json): {'name': '保险agent', 'avatar': 'custom_bot_avatar.png', 'description': '保险领域专业人士,负责对保险理赔进行分析处理', 'instruction': '分析保险责任,计算理赔金额。', 'prompt_recommend': ['你可以做什么?', '你有
什么功能?', '如何使用你的功能?', '能否给我一些示例指令?'], 'knowledge': [], 'tools': {'image_gen': {'name': 'Wanx Image Generation', 'is_active': True, 'use': False, 'is_remote_tool': True}, 'code_interpreter': {'name': 'Code Interpreter', 'is_active': True, 'use': True, 'is_remote_tool': False, 'max_output': 2000}, 'web_browser': {'name': 'Web Browsing', 'is_active': True, 'use': False, 'max_browser_length': 2000}, 'amap_weather': {'name': '高德天气', 'is_active': True, 'use': False}, 'wordart_texture_generation': {'name': '艺术字纹理生成', 'is_active': True, 'use': False}, 'paraformer_asr': {'name': 'Paraformer语音识别', 'is_active': True, 'use': False, 'is_remote_tool': True}, 'sambert_tts': {'name': 'Sambert语音合成', 'is_active': True, 'use': False, 'is_remote_tool': True}, 'web_search': {'name': 'Web Searching', 'is_active': True, 'use': False, 'searcher': 'bing'}, 'qwen_vl': {'name': 'Qwen-VL识图', 'is_active': True, 'use': False}, 'style_repaint': {'name': '人物风格重绘', 'is_active': True, 'use': False}, 'image_enhancement': {'name': '追影-放大镜', 'is_active': True, 'use': False}, 'text-address': {'name': '地址解析', 'url': 'https://api-inference.modelscope.cn/api-inference/v1/models/damo/mgeo_geographic_elements_tagging_chinese_base', 'use': False, 'is_active': True, 'is_remote_tool': True}, 'speech-generation': {'name': '语音生成', 'url': 'https://api-inference.modelscope.cn/api-inference/v1/models/damo/speech_sambert-hifigan_tts_zh-cn_16k', 'use': False, 'is_active': True, 'is_remote_tool': True}, 'video-generation': {'name': '视频生成', 'url': 'https://api-inference.modelscope.cn/api-inference/v1/models/damo/text-to-video-synthesis', 'use': False, 'is_active': True, 'is_remote_tool': True}}, 'model': 'qwen-max', 'language': 'zh'}"} | step: | error:
2024-02-26 16:20:31.327 - modelscope-agent - INFO - | message: using model qwen-max | uuid: local_user | details: {'model_config': {'type': 'dashscope', 'model': 'qwen-max', 'length_constraint': {'knowledge': 4000, 'input': 6000}, 'generate_cfg': {'use_raw_prompt': True, 'top_p': 0.5, 'stop': 'Observation'}}} | step: | error:
INFO: kernel process's PID = 13524
Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python
Python runtime state: preinitialized

@mushenL
Copy link
Collaborator

mushenL commented Feb 28, 2024

您好,可以提供一下您的python环境以及操作系统吗?根据您提供的文档,您是运行app.py之后报错,还是运行了将appBot.py改名为app.py之后报的错?从您这边提供的报错信息来看是您的Python在尝试初始化哈希随机化时遇到了问题,可能是系统权限问题或者环境依赖问题,您可以实时用部署文档中提供的modelscope-agent镜像拉起来的容器部署一下试试?

@lllLllori
Copy link
Author

在执行本地部署第二步sudo nvidia-docker run -ti --net host -v /data/work:/data/work registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope-agent:v0.3.0 bash的时候报错了:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: load library failed: /usr/lib/wsl/drivers/nvlti.inf_amd64_b169173487045715/libnvidia-ml.so.1: file too short: unknown.
ERRO[0000] error waiting for container: context canceled

@zzhangpurdue
Copy link
Collaborator

看起来是环境的问题,是否可以考虑千万modelscope的免费notebook上使用。
或者重新装一个conda环境用python 3.9?

@zzhangpurdue zzhangpurdue added the envrionment any issues with envrionment setting problem label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
envrionment any issues with envrionment setting problem
Projects
None yet
Development

No branches or pull requests

3 participants