chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
31.44k stars 5.48k forks source link

报错ModuleNotFoundError: No module named 'configs.model_config' #112

Closed MrJungleMonkey closed 1 year ago

MrJungleMonkey commented 1 year ago

更新代码后,运行webui.py,报错ModuleNotFoundError: No module named 'configs.model_config'。未查得解决方法。

imClumsyPanda commented 1 year ago

请问时手动只下载了webui.py吗 还是使用git pull 更新的呢?

MrJungleMonkey commented 1 year ago

请问时手动只下载了webui.py吗 还是使用git pull 更新的呢?

手动下载了全部code包并复制粘贴替换。

imClumsyPanda commented 1 year ago

如果已经下载了全部代码,应该在项目路径下有configs文件夹,其中存在model_config.py即上述代码中报错所需文件

MrJungleMonkey commented 1 year ago

如果已经下载了全部代码,应该在项目路径下有configs文件夹,其中存在model_config.py即上述代码中报错所需文件

是的,model_config.py文件存在并路径正确。但运行确实会报错

imClumsyPanda commented 1 year ago

请问是否是在项目所在文件夹路径下运行的webui.py呢?

MrJungleMonkey commented 1 year ago

请问是否是在项目所在文件夹路径下运行的webui.py呢?

是在项目所在文件夹路径下运行的。项目文件并没有做过什么改动

imClumsyPanda commented 1 year ago

请问python版本是多少

MrJungleMonkey commented 1 year ago

请问python版本是多少

python 3.9环境。以下为全部环境信息:

(venv) PS E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main> python --version Python 3.9.13 (venv) PS E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main> pip freeze absl-py==1.4.0 aiofiles==23.1.0 aiohttp==3.8.4 aiosignal==1.3.1 altair==4.2.2 antlr4-python3-runtime==4.9.3 anyio==3.6.2 argilla==1.4.0 astunparse==1.6.3 async-timeout==4.0.2 attrs==22.2.0 automium==0.2.6 automium-web==0.1.1 backoff==2.2.1 beautifulsoup4==4.11.2 cachetools==5.3.0 certifi==2022.12.7 cffi==1.15.1 charset-normalizer==3.1.0 click==8.1.3 colorama==0.4.6 coloredlogs==15.0.1 commonmark==0.9.1 configs==3.0.3 contourpy==1.0.7 cpm-kernels==1.0.11 cryptography==39.0.2 cycler==0.11.0 dataclasses-json==0.5.7 datasets==2.10.1 Deprecated==1.2.13 dill==0.3.6 effdet==0.3.0 entrypoints==0.4 et-xmlfile==1.1.0 faiss-cpu==1.7.3 fastapi==0.95.0 ffmpy==0.3.0 filelock==3.10.0 Flask==2.2.3 flatbuffers==23.3.3 fonttools==4.39.2 frozenlist==1.3.3 fsspec==2023.3.0 gast==0.4.0 google-auth==2.16.2 google-auth-oauthlib==0.4.6 google-pasta==0.2.0 gptcache==0.1.11 gradio==3.22.1 greenlet==2.0.2 grpcio==1.51.3 h11==0.14.0 h5py==3.8.0 httpcore==0.16.3 httpx==0.23.3 huggingface-hub==0.13.2 humanfriendly==10.0 icetk==0.0.5 idna==3.4 importlib-metadata==6.1.0 importlib-resources==5.12.0 iopath==0.1.10 itsdangerous==2.1.2 jieba==0.42.1 Jinja2==3.1.2 joblib==1.2.0 jsonschema==4.17.3 keras==2.11.0 kiwisolver==1.4.4 langchain==0.0.141 layoutparser==0.3.4 legacy==0.1.6 libclang==15.0.6.1 linkify-it-py==2.0.0 lxml==4.9.2 Markdown==3.4.1 markdown-it-py==2.2.0 MarkupSafe==2.1.2 marshmallow==3.19.0 marshmallow-enum==1.5.1 matplotlib==3.7.1 mdit-py-plugins==0.3.3 mdurl==0.1.2 monotonic==1.6 mpmath==1.3.0 multidict==6.0.4 multiprocess==0.70.14 mypy-extensions==1.0.0 networkx==3.0 nltk==3.8.1 numpy==1.23.5 oauthlib==3.2.2 omegaconf==2.3.0 onnxruntime==1.14.1 openai==0.27.4 openapi-schema-pydantic==1.2.4 opencv-python==4.6.0.66 openpyxl==3.1.2 opt-einsum==3.3.0 orjson==3.8.7 packaging==23.0 pandas==1.5.3 pdf2image==1.16.3 pdfminer.six==20221105 pdfplumber==0.8.0 Pillow==9.4.0 portalocker==2.7.0 protobuf==3.19.5 pyarrow==11.0.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycocotools==2.0.6 pycparser==2.21 pydantic==1.10.6 pydub==0.25.1 Pygments==2.14.0 pypandoc==1.11 pyparsing==3.0.9 pyreadline3==3.4.1 pyrsistent==0.19.3 pytesseract==0.3.10 python-dateutil==2.8.2 python-docx==0.8.11 python-magic==0.4.27 python-multipart==0.0.6 python-pptx==0.6.21 pytz==2022.7.1 pywin32==305 PyYAML==6.0 regex==2022.10.31 requests==2.28.2 requests-oauthlib==1.3.1 responses==0.18.0 rfc3986==1.5.0 rich==13.0.1 rouge==1.0.1 rouge-chinese==1.0.3 rsa==4.9 scikit-learn==1.2.2 scipy==1.10.1 sentence-transformers==2.2.2 sentencepiece==0.1.97 six==1.16.0 sniffio==1.3.0 soupsieve==2.4 SQLAlchemy==1.4.47 starlette==0.26.1 sympy==1.11.1 tenacity==8.2.2 tensorboard==2.11.2 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow==2.11.0 tensorflow-estimator==2.11.0 tensorflow-intel==2.11.0 tensorflow-io-gcs-filesystem==0.31.0 termcolor==2.2.0 tesseract==0.1.3 threadpoolctl==3.1.0 timm==0.6.12 tokenizers==0.13.2 toolz==0.12.0 torch==1.13.1+cu116 torchvision==0.14.1+cu116 tqdm==4.65.0 transformers==4.27.1 typing-inspect==0.8.0 typing_extensions==4.5.0 uc-micro-py==1.0.1 unstructured==0.5.4 unstructured-inference==0.2.11 urllib3==1.26.15 uvicorn==0.21.1 Wand==0.6.11 websockets==10.4 Werkzeug==2.2.3 wrapt==1.14.1 XlsxWriter==3.0.9 xxhash==3.2.0 yarl==1.8.2 zipp==3.15.0

MrJungleMonkey commented 1 year ago

全部报错信息如下,供您参考:

Traceback (most recent call last): File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\webui.py", line 4, in from chains.local_doc_qa import LocalDocQA File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\chains\local_doc_qa.py", line 6, in from models.chatglm_llm import ChatGLM File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\models__init__.py", line 2, in from .chatglm_llm import * File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\models\chatglm_llm.py", line 6, in from configs.model_config import LLM_DEVICE ModuleNotFoundError: No module named 'configs.model_config'

imClumsyPanda commented 1 year ago

建议试试存储路径改为全英文是否可行

MrJungleMonkey @.***>于2023年4月17日 周一13:16写道:

全部报错信息如下,供您参考:

Traceback (most recent call last): File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\webui.py", line 4, in from chains.local_doc_qa import LocalDocQA File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\chains\local_doc_qa.py", line 6, in from models.chatglm_llm import ChatGLM File "E:\01进行项目#0Y0_AI_Arch\02digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\models init_.py", line 2, in from .chatglm_llm import * File "E:\01进行项目#0Y0_AI_Arch\02_digital-humanities\ChatGLM-6B-main\langchain-ChatGLM-master\models\chatglm_llm.py", line 6, in from configs.model_config import LLM_DEVICE ModuleNotFoundError: No module named 'configs.model_config'

— Reply to this email directly, view it on GitHub https://github.com/imClumsyPanda/langchain-ChatGLM/issues/112#issuecomment-1510716838, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLH5EQO7E2U73P62OKIKC3XBTG4RANCNFSM6AAAAAAXAT3FMY . You are receiving this because you commented.Message ID: @.***>

MrJungleMonkey commented 1 year ago

感谢,重新更换了项目保存路径后,没有再报错,代码能够运行。 但代码运行后,显示: No sentence-transformers model found with name C:\Users\50902/.cache\torch\sentence_transformers\GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling. No sentence-transformers model found with name C:\Users\50902/.cache\torch\sentence_transformers\GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling. Running on local URL: http://0.0.0.0:7860 web未自动打开。点击上述url进入,显示“无法访问此页面”“ERR_ADDRESS_INVALID”

imClumsyPanda commented 1 year ago

gradio 运行后不会自动打开,请尝试在浏览器中打开 localhost:7860 或 本机ip:7860

MrJungleMonkey @.***>于2023年4月17日 周一13:52写道:

感谢,重新更换了项目保存路径后,没有再报错,代码能够运行。 但代码运行后,显示: No sentence-transformers model found with name C:\Users\50902/.cache\torch\sentence_transformers\GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling. No sentence-transformers model found with name C:\Users\50902/.cache\torch\sentence_transformers\GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling. Running on local URL: http://0.0.0.0:7860 web未自动打开。点击上述url进入,显示“无法访问此页面”“ERR_ADDRESS_INVALID”

— Reply to this email directly, view it on GitHub https://github.com/imClumsyPanda/langchain-ChatGLM/issues/112#issuecomment-1510744275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLH5EQRINWGDGEGTLXYJVTXBTLBPANCNFSM6AAAAAAXAT3FMY . You are receiving this because you commented.Message ID: @.***>

MrJungleMonkey commented 1 year ago

感谢!

autumn11 commented 1 year ago

我也遇到同样的问题,项目所在路径也不存在中文路径,但还是报错 Traceback (most recent call last): File "/Users/linqiu/java/ideaworkspace/langchain-ChatGLM/webui.py", line 4, in from chains.local_doc_qa import LocalDocQA File "/Users/linqiu/java/ideaworkspace/langchain-ChatGLM/chains/local_doc_qa.py", line 4, in from models.chatglm_llm import ChatGLM File "/Users/linqiu/java/ideaworkspace/langchain-ChatGLM/models/init.py", line 2, in from .chatglm_llm import File "/Users/linqiu/java/ideaworkspace/langchain-ChatGLM/models/chatglm_llm.py", line 6, in from configs.model_config import ModuleNotFoundError: No module named 'configs.model_config'

autumn11 commented 1 year ago

@imClumsyPanda ,大佬帮忙看看,Python版本是3.10.10

imClumsyPanda commented 1 year ago

运行webui的路径是在项目路径下吗

autumn11 @.***>于2023年5月5日 周五15:44写道:

@imClumsyPanda https://github.com/imClumsyPanda ,大佬帮忙看看,Python版本是3.10.10

— Reply to this email directly, view it on GitHub https://github.com/imClumsyPanda/langchain-ChatGLM/issues/112#issuecomment-1535858191, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLH5ESYRE2MFNNN3ICL4FLXESVXPANCNFSM6AAAAAAXAT3FMY . You are receiving this because you were mentioned.Message ID: @.***>

autumn11 commented 1 year ago

是,

image
autumn11 commented 1 year ago
image
imClumsyPanda commented 1 year ago

Configs应该是项目路径下的文件夹,不是python包

autumn11 @.***>于2023年5月6日 周六08:49写道:

[image: image] https://user-images.githubusercontent.com/3039629/236589361-95a69b2c-1725-4596-a2b4-fd5ab2ef7f0f.png

— Reply to this email directly, view it on GitHub https://github.com/imClumsyPanda/langchain-ChatGLM/issues/112#issuecomment-1536946852, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLH5EVLRPTM5HJBJQICEKTXEWN25ANCNFSM6AAAAAAXAT3FMY . You are receiving this because you were mentioned.Message ID: @.***>

autumn11 commented 1 year ago
image

确实没有configs.model_config 这个model_config

autumn11 commented 1 year ago

那这个要怎么处理呢?

imClumsyPanda commented 1 year ago

可以试试看直接从terminal运行

如果还是不行,建议尝试新建虚拟环境,只安装requirements.txt的要求包后,再次运行试试看,不确定是不是因为安装了configs包的影响

autumn11 commented 1 year ago

@imClumsyPanda ,搞定了,删了configs包就好了,晕死

wangzaistone commented 1 year ago

@imClumsyPanda ,搞定了,删了configs包就好了,晕死 @autumn11 同学,你这个具体是怎么删的? 我也遇到了同样的问题

wangzaistone commented 1 year ago

@autumn11 直接删了开头的那句”from configs.model_config import NLTK_DATA_PATH“ 或者替换为" import NLTK_DATA_PATH" 都会报错,你怎么删的

@imClumsyPanda ,搞定了,删了configs包就好了,晕死

BUPTLdy commented 1 year ago

@autumn11 直接删了开头的那句”from configs.model_config import NLTK_DATA_PATH“ 或者替换为" import NLTK_DATA_PATH" 都会报错,你怎么删的

@imClumsyPanda ,搞定了,删了configs包就好了,晕死

env\Lib\site-packages

wangzaistone commented 1 year ago

@autumn11 直接删了开头的那句”from configs.model_config import NLTK_DATA_PATH“ 或者替换为" import NLTK_DATA_PATH" 都会报错,你怎么删的

@imClumsyPanda ,搞定了,删了configs包就好了,晕死

env\Lib\site-packages @BUPTLdy 你说的env\Lib\site-packages 是指安装环境里的? 我用conda装的,在/home/anaconda3/envs/langchain/lib下没有找到有site-packages ,我的这个lib下面内容为: image

BUPTLdy commented 1 year ago

@autumn11 直接删了开头的那句”from configs.model_config import NLTK_DATA_PATH“ 或者替换为" import NLTK_DATA_PATH" 都会报错,你怎么删的

@imClumsyPanda ,搞定了,删了configs包就好了,晕死

env\Lib\site-packages @BUPTLdy 你说的env\Lib\site-packages 是指安装环境里的? 我用conda装的,在/home/anaconda3/envs/langchain/lib下没有找到有site-packages ,我的这个lib下面内容为: image

我的是用conda创建的,在当前项目中的lib下找到的。

you-can-change commented 1 year ago

我在参考安装指南。部署完成后, 执行python loader/image_loader.py, 出现同样的报错:

(langchain) root@chatGLM:/data/program/langchain-ChatGLM# python loader/image_loader.py
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
  warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('zope')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
Traceback (most recent call last):
  File "loader/image_loader.py", line 8, in <module>
    from configs.model_config import NLTK_DATA_PATH
ModuleNotFoundError: No module named 'configs.model_config'

我尝试在 loader/image_loader.py 中添加模块路径后运行正常

from typing import List
import sys      # 添加这行
sys.path.append("/data/program/langchain-ChatGLM")   # 添加这行

from langchain.document_loaders.unstructured import UnstructuredFileLoader
from paddleocr import PaddleOCR
bk007lz commented 1 year ago

import sys # 添加这行 sys.path.append("/data/program/langchain-ChatGLM") # 添加这行

为什么我添加了,还是提示这个错误呢? ModuleNotFoundError: No module named 'configs.model_config'

lyric135 commented 1 year ago

因为这个路径的意思是,你的路径,检查一下你是否叫这个,将路径替换成你的地址即可

net592 commented 1 year ago

import sys # 添加这行 sys.path.append("/data/program/langchain-ChatGLM") # 添加这行

为什么我添加了,还是提示这个错误呢? ModuleNotFoundError: No module named 'configs.model_config'

import sys # 引入sys模块 sys.path.append("/data/program/langchain-ChatGLM") # 添加项目绝对路劲

已解决,感谢,确实是路劲不对,导致载入模块失败....

Jason-Chen-2017 commented 1 year ago

报错信息:

(venv) me@ai:~/ai/VisualGLM-6B$ python3 web_demo.py
[2023-06-11 16:44:28,426] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Traceback (most recent call last):
  File "/home/me/ai/VisualGLM-6B/web_demo.py", line 129, in <module>
    main(args)
  File "/home/me/ai/VisualGLM-6B/web_demo.py", line 83, in main
    model, tokenizer = get_infer_setting(gpu_device=0, quant=args.quant)
  File "/home/me/ai/VisualGLM-6B/model/infer_util.py", line 21, in get_infer_setting
    model, args = VisualGLMModel.from_pretrained('visualglm-6b', args)
  File "/home/me/ai/VisualGLM-6B/venv/lib/python3.10/site-packages/sat/model/base_model.py", line 212, in from_pretrained
    args = update_args_with_file(args, path=os.path.join(model_path, 'model_config.json'))
  File "/home/me/ai/VisualGLM-6B/venv/lib/python3.10/site-packages/sat/arguments.py", line 423, in update_args_with_file
    with open(path, 'r', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/me/.sat_models/visualglm-6b/model_config.json'

后来发现文件解压没有完整,正确的解压之后完整的目录应该是这样的:

[16:50:13] me@ai /home/me/.sat_models

tree . . ├── visualglm-6b │   ├── 1 │   │   └── mp_rank_00_model_states.pt │   ├── latest │   └── model_config.json ├── visualglm-6b.zip └── visualglm-6b.zip.lock

2 directories, 5 files

qq460046000 commented 1 year ago

我也是遇到这个报错,求大佬帮忙看看:

(chatglm) aoao@aoao-System-Product-Name:~/langchain-ChatGLM$ python cli_demo.py Traceback (most recent call last): File "/home/aoao/langchain-ChatGLM/cli_demo.py", line 1, in from configs.model_config import * ModuleNotFoundError: No module named 'configs.model_config'

from typing import List

import sys sys.path.append("/home/aoao/langchain-ChatGLM")

from langchain.document_loaders.unstructured import UnstructuredFileLoader from paddleocr import PaddleOCR import os import nltk from configs.model_config import NLTK_DATA_PATH

autumn11 commented 1 year ago

你好:      我的原因是因为手欠执行了 “pip install configs”,configs是项目下的一个文件夹,如果这么干了的话,就会找不到项目下的configs文件夹 允许 “pip uninstall configs”  就好了

林秋 @.***

 

------------------ 原始邮件 ------------------ 发件人: "imClumsyPanda/langchain-ChatGLM" @.>; 发送时间: 2023年6月15日(星期四) 中午11:51 @.>; @.**@.>; 主题: Re: [imClumsyPanda/langchain-ChatGLM] 报错ModuleNotFoundError: No module named 'configs.model_config' (Issue #112)

我也是遇到这个报错,求大佬帮忙看看:

(chatglm) @.**:~/langchain-ChatGLM$ python cli_demo.py Traceback (most recent call last): File "/home/aoao/langchain-ChatGLM/cli_demo.py", line 1, in from configs.model_config import ModuleNotFoundError: No module named 'configs.model_config'

/loader/Image_loader.py文件已改为如下:

from typing import List

import sys sys.path.append("/home/aoao/langchain-ChatGLM")

from langchain.document_loaders.unstructured import UnstructuredFileLoader from paddleocr import PaddleOCR import os import nltk from configs.model_config import NLTK_DATA_PATH

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

harrisHxy commented 1 year ago

首先都执行下这两个命令 : pip uninstall config pip uninstall configs

lsm03624 commented 1 year ago

我在参考安装指南。部署完成后, 执行python loader/image_loader.py, 出现同样的报错:

(langchain) root@chatGLM:/data/program/langchain-ChatGLM# python loader/image_loader.py
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
  warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/data/program/miniconda3/envs/langchain/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('zope')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
Traceback (most recent call last):
  File "loader/image_loader.py", line 8, in <module>
    from configs.model_config import NLTK_DATA_PATH
ModuleNotFoundError: No module named 'configs.model_config'

我尝试在 loader/image_loader.py 中添加模块路径后运行正常

from typing import List
import sys      # 添加这行
sys.path.append("/data/program/langchain-ChatGLM")   # 添加这行

from langchain.document_loaders.unstructured import UnstructuredFileLoader
from paddleocr import PaddleOCR

多谢,按照这个方法解决了!

sdyjmc commented 1 year ago

vim ~/.bashrc export PYTHONPATH=./:$PYTHONPATH

简单的项目和测试代码非常有用

zyhui98 commented 1 year ago
import sys
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
net592 commented 1 year ago

谢谢您的邮件。我会尽快回复您!                                          

lesliewang895 commented 12 months ago

现在的安装配置文档还是老版的,新版的包里面的configs目录下的所有.py.example文件均需拷贝为.py文件,否则会提示找不到模块错误,请作者及时更新文档。

sisuad commented 9 months ago

现在的安装配置文档还是老版的,新版的包里面的configs目录下的所有.py.example文件均需拷贝为.py文件,否则会提示找不到模块错误,请作者及时更新文档。

我发现了,确实有你说的这个问题,23年12月18日拉下来的项目还存在

net592 commented 9 months ago

:-) 您好,收到了 ,尽快恢复

imClumsyPanda commented 9 months ago

现在的安装配置文档还是老版的,新版的包里面的configs目录下的所有.py.example文件均需拷贝为.py文件,否则会提示找不到模块错误,请作者及时更新文档。

我发现了,确实有你说的这个问题,23年12月18日拉下来的项目还存在

请参考 README.md 中对应章节 https://github.com/chatchat-space/Langchain-Chatchat#3-%E5%88%9D%E5%A7%8B%E5%8C%96%E7%9F%A5%E8%AF%86%E5%BA%93%E5%92%8C%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6