Coder Social home page Coder Social logo

Comments (9)

von-eureka avatar von-eureka commented on August 14, 2024

我尝试使用 pip install llama_index.core重新安装之后,报错变成了

ValidationError
1 validation error for DataSource
component_type
subclass of BaseComponent expected (type=type_error.subclass; expected_class=BaseComponent)
File "/home/ureka/history_rag-master/executor.py", line 12, in
from llama_index.core import ServiceContext, StorageContext
pydantic.v1.error_wrappers.ValidationError: 1 validation error for DataSource
component_type
subclass of BaseComponent expected (type=type_error.subclass; expected_class=BaseComponent)

from history_rag.

wxywb avatar wxywb commented on August 14, 2024
pip list|grep llama

from history_rag.

von-eureka avatar von-eureka commented on August 14, 2024

llama-index 0.9.39
llama-index-core 0.10.13
llamaindex-py-client 0.1.13

from history_rag.

wxywb avatar wxywb commented on August 14, 2024

把这些都pip uninstall
然后只装这个llama-index 0.9.39

from history_rag.

von-eureka avatar von-eureka commented on August 14, 2024

按照pip list|grep llama操作以后,返回的结果是llama-index 0.9.39,但是运行后报错:

ImportError: cannot import name 'ServiceContext' from 'llama_index.core' (/home/ureka/.local/lib/python3.10/site-packages/llama_index/core/init.py)

from history_rag.

wxywb avatar wxywb commented on August 14, 2024

完整的stacktrace打印一下?

from history_rag.

von-eureka avatar von-eureka commented on August 14, 2024

File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/ureka/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in
cli.main()
File "/home/ureka/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/ureka/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="main")
File "/home/ureka/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/ureka/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/ureka/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/home/ureka/history_rag-master/executor.py", line 12, in
from llama_index.core import ServiceContext, StorageContextImportError: cannot import name 'ServiceContext' from 'llama_index.core' (/home/ureka/.local/lib/python3.10/site-packages/llama_index/core/init.py)

from history_rag.

wxywb avatar wxywb commented on August 14, 2024

exec(code, run_globals)
File "/home/ureka/history_rag-master/executor.py", line 12, in
from llama_index.core import ServiceContext, StorageContextImportError: cannot import name 'ServiceContext' from 'llama_index.core' (/home/ureka/.local/lib/python3.10/site-packages/llama_index/core/init.py)

from llama_index import ServiceContext, StorageContext

为什么第12行并不一致

#你的import
from llama_index.core import ServiceContext, StorageContext
#我的import
from llama_index import ServiceContext, StorageContext

from history_rag.

von-eureka avatar von-eureka commented on August 14, 2024

我也不清楚.....但是我按照你的代码修改了以后便可以运行了,谢谢大佬!

from history_rag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.