Facing issue when replicating code

Summary

So am reading this blog and getting error

Steps to reproduce

code can be found in the blog

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Run seemlessly
Actual behavior:

everything is same as in the blog and using my own api key

Hey @IM45145V,

Are you running this app locally or in Community Cloud? If you’re running it locally, have you installed the dependencies from the requirements.txt file?

I did it in both Local and cloud
same error
yes i installed all dependencies mentioned

Deployed it in cloud by forking your repo

Can you share the full error message that you’re seeing when you deploy it in Community Cloud (and ideally the link to the deployed app)? I’ve tried to reproduce this but unfortunately haven’t been able to

[18:11:15] 🐍 Python dependencies were installed from /mount/src/mineengine/requirements.txt using pip.

Check if streamlit is installed

Streamlit is already installed

[18:11:17] 📦 Processed dependencies!


Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.





2023-09-18 18:11:40.046 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/mineengine/streamlit_app.py", line 2, in <module>

    from llama_index import VectorStoreIndex, ServiceContext, Document

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/__init__.py", line 12, in <module>

    from llama_index.data_structs.struct_type import IndexStructType

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/__init__.py", line 3, in <module>

    from llama_index.data_structs.data_structs import (

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/data_structs.py", line 14, in <module>

    from llama_index.schema import BaseNode, TextNode

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/schema.py", line 12, in <module>

    from llama_index.bridge.langchain import Document as LCDocument

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/bridge/langchain.py", line 20, in <module>

    from langchain.embeddings.base import Embeddings

ModuleNotFoundError: No module named 'langchain.embeddings.base'

2023-09-18 18:11:58.567 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/mineengine/streamlit_app.py", line 2, in <module>

    from llama_index import VectorStoreIndex, ServiceContext, Document

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/__init__.py", line 12, in <module>

    from llama_index.data_structs.struct_type import IndexStructType

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/__init__.py", line 3, in <module>

    from llama_index.data_structs.data_structs import (

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/data_structs.py", line 14, in <module>

    from llama_index.schema import BaseNode, TextNode

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/schema.py", line 12, in <module>

    from llama_index.bridge.langchain import Document as LCDocument

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/bridge/langchain.py", line 20, in <module>

    from langchain.embeddings.base import Embeddings

ModuleNotFoundError: No module named 'langchain.embeddings.base'

2023-09-19 13:06:23.612 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/mineengine/streamlit_app.py", line 2, in <module>

    from llama_index import VectorStoreIndex, ServiceContext, Document

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/__init__.py", line 12, in <module>

    from llama_index.data_structs.struct_type import IndexStructType

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/__init__.py", line 3, in <module>

    from llama_index.data_structs.data_structs import (

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/data_structs.py", line 14, in <module>

    from llama_index.schema import BaseNode, TextNode

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/schema.py", line 12, in <module>

    from llama_index.bridge.langchain import Document as LCDocument

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/bridge/langchain.py", line 20, in <module>

    from langchain.embeddings.base import Embeddings

ModuleNotFoundError: No module named 'langchain.embeddings.base'

2023-09-19 13:06:26.120 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/mineengine/streamlit_app.py", line 2, in <module>

    from llama_index import VectorStoreIndex, ServiceContext, Document

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/__init__.py", line 12, in <module>

    from llama_index.data_structs.struct_type import IndexStructType

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/__init__.py", line 3, in <module>

    from llama_index.data_structs.data_structs import (

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/data_structs.py", line 14, in <module>

    from llama_index.schema import BaseNode, TextNode

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/schema.py", line 12, in <module>

    from llama_index.bridge.langchain import Document as LCDocument

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/bridge/langchain.py", line 20, in <module>

    from langchain.embeddings.base import Embeddings

ModuleNotFoundError: No module named 'langchain.embeddings.base'

2023-09-19 14:53:46.642 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/mineengine/streamlit_app.py", line 2, in <module>

    from llama_index import VectorStoreIndex, ServiceContext, Document

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/__init__.py", line 12, in <module>

    from llama_index.data_structs.struct_type import IndexStructType

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/__init__.py", line 3, in <module>

    from llama_index.data_structs.data_structs import (

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/data_structs/data_structs.py", line 14, in <module>

    from llama_index.schema import BaseNode, TextNode

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/schema.py", line 12, in <module>

    from llama_index.bridge.langchain import Document as LCDocument

  File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/bridge/langchain.py", line 20, in <module>

    from langchain.embeddings.base import Embeddings

ModuleNotFoundError: No module named 'langchain.embeddings.base'

I tried to reproduce the error but it works fine for me, try redeploying the app/ changing python versions

Can you tell the version you were using

Sorry for the delayed response, I am still trying (unsuccessfully) to reproduce the error. Good point @Navin_Chandra on the Python version, although I’d be surprised if that’s causing the issue on the deployed version since mine is also using the default Python version

Cool i’ll try redeploying
hope it will work this time

I used 3.10 but I have also checked with other available versions and all work fine.

I tried it again it worked for a while and again same errors

not even changed the code just forked from their repo


tenacity.RetryError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
File "/mount/src/mineengine/streamlit_app.py", line 26, in <module>
    index = load_data()
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 211, in wrapper
    return cached_func(*args, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 242, in __call__
    return self._get_or_create_cached_value(args, kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 266, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 320, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
File "/mount/src/mineengine/streamlit_app.py", line 23, in load_data
    index = VectorStoreIndex.from_documents(docs, service_context=service_context)
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/base.py", line 102, in from_documents
    return cls(
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py", line 46, in __init__
    super().__init__(
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/base.py", line 71, in __init__
    index_struct = self.build_index_from_nodes(nodes)
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py", line 265, in build_index_from_nodes
    return self._build_index_from_nodes(nodes)
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py", line 253, in _build_index_from_nodes
    self._add_nodes_to_index(
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py", line 213, in _add_nodes_to_index
    nodes = self._get_node_with_embedding(nodes, show_progress)
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py", line 111, in _get_node_with_embedding
    ) = self._service_context.embed_model.get_queued_text_embeddings(show_progress)
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/embeddings/base.py", line 223, in get_queued_text_embeddings
    embeddings = self._get_text_embeddings(cur_batch_texts)
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/embeddings/openai.py", line 314, in _get_text_embeddings
    return get_embeddings(
File "/home/adminuser/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
File "/home/adminuser/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
File "/home/adminuser/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()

Your previous app (NB branch) works fine right now - https://mineengine.streamlit.app/

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.