英文:
ImportError: cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders'
问题
以下是翻译好的部分:
我在尝试在我的Mac上运行本地GPT的克隆仓库时遇到以下错误。我已成功安装了requirements.txt文件中的所有内容。
这种情况发生在多个Python仓库和其他导入中。这是否是路径问题?我应该如何修复这些问题。
Traceback (most recent call last):
File "/Documents/GitHub/localGPT/ingest.py", line 12, in <module>
from constants import (CHROMA_SETTINGS, DOCUMENT_MAP, EMBEDDING_MODEL_NAME, INGEST_THREADS, PERSIST_DIRECTORY,
File "/Documents/GitHub/localGPT/constants.py", line 7, in <module>
from langchain.document_loaders import (
ImportError: 无法从'langchain.document_loaders'导入名称'UnstructuredExcelLoader'(/anaconda3/lib/python3.10/site-packages/langchain/document_loaders/__init__.py)
我已经在Coda、终端应用程序和VS Code中运行了这个命令。
英文:
I am getting the following errors when trying to run a cloned repo of localGPT on my mac. I have successfully installed everything in the requirements.txt file.
This is happening with multiple python repos and other imports. Is this a path issue? How might I fix those.
Traceback (most recent call last):
File "/Documents/GitHub/localGPT/ingest.py", line 12, in <module>
from constants import (CHROMA_SETTINGS, DOCUMENT_MAP, EMBEDDING_MODEL_NAME, INGEST_THREADS, PERSIST_DIRECTORY,
File "/Documents/GitHub/localGPT/constants.py", line 7, in <module>
from langchain.document_loaders import (
ImportError: cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders' (/anaconda3/lib/python3.10/site-packages/langchain/document_loaders/__init__.py)
I have run this in Coda, through the terminal app, and in VS Code.
答案1
得分: 1
我找到了一个关于“无法从 'langchain.document_loaders' 导入名称 'UnstructuredExcelLoader'”的问题,详细信息请参考 Closed ImportError: cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders' #113。根据 ashokrs 的评论:
UnstructuredExcelLoader 模块已从 langchain 库的早期版本中删除。很抱歉,我不知道具体是哪个版本。如果你正在使用较旧的库版本,你需要升级到新的版本才能使用 UnstructuredExcelLoader 模块。
不仅仅是这个错误,你可能需要仔细运行 "pip install -r requirements.txt" 来更新许多 Python 库,以考虑最近拉取以来的所有更改。请注意,“requirements.txt”也在昨天更改过。
我相信你可以使用 pip install langchain --upgrade
来进行升级。出于某种原因,ashokrs 建议使用 pip uninstall langchain
然后再使用 pip install langchain
。我不确定它们之间的区别。也可以参考 https://stackoverflow.com/q/4536103/11107541。
英文:
Googling ""cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders'"
", I found Closed
ImportError: cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders' #113. Quoting from a comment by @ashokrs there:
> The UnstructuredExcelLoader module was removed from one of the earlier versions of the langchain library. Sorry, I don't know which one specifically. If you are using an older version of the library, you will need to upgrade to a newer version in order to use the UnstructuredExcelLoader module.
>
> Not only this error you had come across so far, You may need to carefully run "pip install -r requirements.txt" to update many python libraries to factor in all the changes since your recent pull. Please see that the "requirements.txt" is also changed yesterday.
I believe you can upgrade using pip install langchain --upgrade
. For some reason, @ashokrs suggested instead to do pip uninstall langchain
and then pip install langchain
. I'm not sure what the difference is. See also https://stackoverflow.com/q/4536103/11107541.
答案2
得分: 1
如果您的问题无法通过pip install langchain --upgrade
或pip uninstall langchain
然后pip install langchain
来解决。
只需重新启动您的集成开发环境(IDE),大多数情况下它会解决问题。
英文:
If your issue doesn't get resolved with pip install langchain --upgrade
or
pip uninstall langchain
and then pip install langchain
.
Just Restart your IDE, mostly it will solve the problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论