run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.84k stars 5.28k forks source link

[Bug]: ModuleNotFoundError: No module named 'llama_index.utilities' #14179

Closed arvindkc closed 5 months ago

arvindkc commented 5 months ago

Bug Description

I was trying to chat with a database following instructions here and received the error No module named 'llama_index.utilities'

Version

0.10.45

Steps to Reproduce

Execute the contents of this workbook to repro this error https://github.com/run-llama/llama-hub/blob/main/llama_hub/tools/notebooks/intro_to_tools.ipynb

Relevant Logs/Tracbacks

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
  File "/Users/kc/dev/kc-pygwalker-demo/pages/3_📀_Chat_with_datalake.py", line 7, in <module>
    from llama_hub.tools.database.base import DatabaseToolSpec
  File "/opt/homebrew/lib/python3.11/site-packages/llama_hub/tools/database/__init__.py", line 2, in <module>
    from llama_hub.tools.database.base import (
  File "/opt/homebrew/lib/python3.11/site-packages/llama_hub/tools/database/base.py", line 5, in <module>
    from llama_index.utilities.sql_wrapper import SQLDatabase
dosubot[bot] commented 5 months ago

Hey @arvindkc! I'm a bot designed to help you with bug fixes, questions, and contributions. Feel free to ask for assistance while waiting for a human maintainer.

The error "No module named 'llama_index.utilities'" is likely due to recent changes in the llama_index package that affect the import paths. Specifically, the utilities module has been moved under llama_index.core.

To resolve this issue, update your import statement as follows:

from llama_index.core.utilities.sql_wrapper import SQLDatabase

This change should align with the new module structure in version 0.10.45 [1].

To continue talking to Dosu, mention @dosu.

logan-markewich commented 5 months ago

@arvindkc llamahub repo is deprecated, and not expected to work (check out the readme over there, I think there's also a banner at the top)

If you are trying to use tools from that notebook, you need to install them

pip install llama-index-tools-database

https://llamahub.ai/l/tools/llama-index-tools-database?from=