li-plus / chatglm.cpp

C++ implementation of ChatGLM-6B & ChatGLM2-6B & ChatGLM3 & GLM4
MIT License
2.81k stars 327 forks source link

[Solved] Windows 上 chatglm_cpp 模块 "DLL load failed while importing _C" 问题 #297

Open LTHPKBTE opened 1 month ago

LTHPKBTE commented 1 month ago

由于想要使用 cuda 加速,我添加了对应环境变量 ”CMAKE_ARGS“=“-DGGML_CUBLAS=ON” 后使用 pip install git+https://github.com/li-plus/chatglm.cpp.git@main 命令安装并编译。 然后尝试运行命令 streamlit run .\chatglm.cpp\examples\chatglm3_demo.py 报错如下:

2024-05-09 11:46:26.304 Uncaught app exception
Traceback (most recent call last):
  File "E:\python\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 600, in _run_script
    exec(code, module.__dict__)
  File "E:\ChatGLM3\chatglm.cpp\examples\chatglm3_demo.py", line 14, in <module>
    import chatglm_cpp
  File "E:\python\Lib\site-packages\chatglm_cpp\__init__.py", line 6, in <module>
    import chatglm_cpp._C as _C
ImportError: DLL load failed while importing _C: 找不到指定的模块。

我的 Python 版本为:Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32 在 E:\python\Lib\site-packages\chatglm_cpp 文件夹下可以找到 _C.cp311-win_amd64.pyd 文件。 应该如何继续排查问题?我上网搜索后并没有比较有效的信息。谢谢。

Fros1er commented 1 month ago

181

LTHPKBTE commented 1 month ago

181

谢谢,但由于需要外部操作才能修复这个问题,这个 issue 我暂时留在这里供其他人参考。